Working with Dates

Date Formatting

The format used is a restricted form of the canonical representation of dateTime in the XML Schema specification (ISO 8601):


  • YYYY is the year.
  • MM is the month.
  • DD is the day of the month.
  • hh is the hour of the day as on a 24-hour clock.
  • mm is minutes.
  • ss is seconds.
  • Z is a literal 'Z' character indicating that this string representation of the date is in UTC

Note that no time zone can be specified; the String representations of dates is always expressed in Coordinated Universal Time (UTC). Here is an example value:


You can optionally include fractional seconds if you wish, although any precision beyond milliseconds will be ignored. Here are examples value with sub-seconds include:

  • 2016-03-27T13:47:26.822Z
  • 2016-03-27T13:47:26.82Z
  • 2016-03-27T13:47:26.8Z

Date Math

The date field types also supports date math expressions, which makes it easy to create times relative to fixed moments in time, include the current time which can be represented using the special value of "NOW".

Date Math Syntax

Date math expressions consist either adding some quantity of time in a specified unit, or rounding the current time by a specified unit. expressions can be chained and are evaluated left to right.

For example: this represents a point in time two months from now:


This is one day ago:


A slash is used to indicate rounding. This represents the beginning of the current hour:


The following example computes (with millisecond precision) the point in time six months and three days into the future and then rounds that time to the beginning of that day:


Here is the supported keywords in Date Math:
Date part keywords
Alternatives keywords
Description Round part?
It represents current date time.
It represents the year part of date time.
It represents the month part of date time.
It represents the day part of date time.
It represents the hour part of date time.
MINUTE MINUTES It represents the minute part of date time.
SECOND SECONDS It represents the second part of date time.