Date/Time Processing Functions

This section describes expression language functions related to processing timestamps.

Function

Description

Result Type

Backend Support

Frontend Support

date(Integer year, Integer month, Integer day, Integer hour, Integer minute, Integer second [, Integer millisecond [, String timezone]])

Constructs date by the specified year, month, day, hour, minute, and second values. Note, that month is zero-based, i.e. value for January is 0.

The default time zone used to construct timestamps is UTC. Custom time zones can be specified in the string form, e.g.:

  • GMT-8

  • GMT-08:00

  • America/Los_Angeles

Date

Yes

Yes

dateAdd(Date date, Integer count, String unit [, String timezone])

Adds count periods of time specified by named unit(s) to the date, and returns the result. See unit names above.

The default time zone used for the operation is UTC. Custom time zones can be specified in the string form, e.g.:

  • GMT-8

  • GMT-08:00

  • America/Los_Angeles

Date

Yes

Yes

dateDiff(Date first, Date second, String unit)

Calculates time passed since first date till second date, measured in named unit(s).

Unit names:

  • millisecond or ms for Milliseconds

  • second, sec or s for Seconds

  • minute, min or m for Minutes

  • hour, hr or h for Hours

  • day or d for Days

  • week or w for Weeks

  • month for Months (Note, that month is zero-based, i.e. value for January is 0.)

  • year or y for Years

Long

Yes

Yes

day(Date date [, String timezone])

Returns day of the specified timestamp. See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

dayOfWeek(Date date [, String timezone])

Returns day of week of the specified timestamp (1 for Sunday). See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

dayOfYear(Date date [, String timezone])

Returns day of year of the specified timestamp. See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

formatDate(Date date, String pattern [, String timezone])

Formats Date value to a String. Date formatting patterns are described here.

The default time zone used to format timestamps is UTC. Custom time zones can be specified in the string form, e.g.:

  • GMT-8

  • GMT-08:00

  • America/Los_Angeles

String

Yes

Yes

To format a date to string suitable for reconstructing a Data Table from string parameter list, use the following pattern: yyyy-MM-dd HH:mm:ss.SSS.

hour(Date date [, String timezone])

Returns hour of the specified timestamp. See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

millisecond(Date date)

Returns millisecond of the specified timestamp.

Integer

Yes

Yes

minute(Date date [, String timezone])

Returns minute of the specified timestamp. See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

month(Date date [, String timezone])

Returns month of the specified timestamp (0 for January). See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

now()

Returns current date/time.

Date

Yes

Yes

second(Date date)

Returns second of the specified timestamp.

Integer

Yes

Yes

parseDate(String source, String pattern [, String timezone])

Parses a Date value from a String. Date patterns are described here.

The default time zone used to construct timestamps is UTC. Custom time zones can be specified in the string form, e.g.:

  • GMT-8

  • GMT-08:00

  • America/Los_Angeles

Date

Yes

Yes

printPeriod(Long period [, minUnit [, maxUnit]])

Intelligently formats a time period (expressed in milliseconds) as a string in form: X days X hours X minutes X seconds. minUnit and maxUnit are minimal and maximal integer unit types to be used when rendering or editing the period. Available units are described here, Week and Quarter units are not supported.

String

Yes

Yes

time(Date date)

Returns number of milliseconds since Epoch for the specified timestamp.

Long

Yes

Yes

year(Date date [, String timezone])

Returns year of the specified timestamp. See description of formatDate function to find out how to specify a certain timezone.

Integer

Yes

Yes

Was this page helpful?