This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.

API Reference@grafana/datadateTimeParse

dateTimeParse variable

dateTimeParse variable

Helper function to parse a number, text or Date to a DateTime value. If a timeZone is supplied the incoming value is parsed with that timeZone as a base. The only exception to this is if the passed value is in a UTC-based format. Then it will use UTC as the base. If no format is specified the current system format will be assumed.

It can also parse the Grafana quick date and time format, e.g. now-6h will be parsed as - 6 hours and returned as a valid DateTime value.

If no options are supplied, then default values are used. For more details please see DateTimeOptions.


dateTimeParse: DateTimeParser<DateTimeOptionsWhenParsing>


import { dateTimeParse } from '@grafana/data';