Date Formatters

Version 23.4.8843


Date Formatters


The list of formatters on this page manipulate dates and times. The syntax for all formatters is the same, as shown below:

[attr | formatter1() | formatter2()]

Attributes (variables) are piped in (using a vertical pipe character - |) to formatters from left to right. The attribute that is piped into file formatters should always be a datetime string. For example, if the attribute myDate is set to a datetime in the format YYYY-MM-dd, then the following code returns the value that represents the day in that date:

[myDate | day('YYYY-MM-dd')]

Many date formatters have a parameters that specify the input or output format for dates; a list of sample date formats is included at the bottom of this page for reference.


compare([value][, inputformat])

Returns a signed number indicating the relative values of dates that are represented by the attribute value and parameter value.

  • value: The optional string representation of the date that is compared with the attribute value. The default value is now.

  • inputformat: The optional input format specifier. The default value is autodetected.

date([outputformat])

Returns the current system date and time in the format that is specified by the parameter, if one is provided.

  • outputformat: The optional format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

dateadd([interval][, integer_value][, outputformat][, inputformat])

Returns a string value of the datetime that results from adding the specified number interval (a signed integer) to the specified date part of the date.

  • interval: The optional interval that you want to add. Specify year, month, day, hour, minute, second, or millisecond.

  • value: The optional number of intervals you want to add. Can either be positive for dates in the future or negative for dates in the past.

  • outputformat: The optional output format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

  • inputformat: The optional input format specifier. The default value is autodetected.

datediff([interval][, value][, inputformat])

Returns the difference (in units that are specified by the first parameter) between now and the date that is specified by the second parameter.

  • interval: The optional interval in which you want the result. Specify day, hour, minute, second, or millisecond.

  • value: The optional string representation of the date to compare with the attribute value. The default value is now.

  • inputformat: The optional input format specifier. The default value is autodetected.

day([inputformat])

Returns the day component, expressed as a value between 1 and 31, of the date that is represented by the attribute value.

  • inputformat: The optional input format specifier. The default value is autodetected.

dayofweek([inputformat])

Returns the day of week for the date that is represented by the attribute value.

  • inputformat: The optional input format specifier. The default value is autodetected.

dayofyear([inputformat])

Returns the day of year expressed as a value between 1 and 366 for the date that is represented by the attribute value.

  • inputformat: The optional input format specifier. The default value is autodetected.

filetimenow()

Returns the date and time for the current system file time.

fromfiletime([outputformat])

Converts a valid file time to a valid datetime value formatted as specified by the parameter, if one is provided.

  • outputformat: The optional output format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

isleap([ifleap][, ifnotleap])

Returns a value of true (or ifleap) if the four-digit year that is represented by the attribute value is a leap year; otherwise, a value of false (or ifnotleap) is returned.

  • ifleap: The optional value that is returned if the attribute value is a leap year.

  • ifnotleap: The optional value that is returned if the attribute value is not a leap year.

month([inputformat])

Returns the month component expressed as a value between 1 and 12 of the date that is represented by the attribute value.

  • inputformat: The optional input format specifier. The default value is autodetected.

now([outputformat])

Returns the current system date and time in the format that is specified by the parameter, if one was provided.

  • outputformat: The optional format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

todate([outputformat][,inputformat])

Returns the date specified by the attribute value that is formatted as specified by the parameter, if one is provided.

  • outputformat: The optional output format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

  • inputformat: The optional input format specifier. The default value is autodetected. The formatter attempts to honor the input format when it parses date attributes. However, if the input attribute does not match the specified input format, the formatter attempts to use known (standard) date formats to parse the input attribute. An error occurs only if the input attribute does not match the specified input format nor any known date formats.

tofiletime([inputformat])

Converts a valid datetime to a valid file time value.

  • inputformat: The optional input format specifier. The default value is autodetected.

tomonth()

Returns the name of the month for the numeric value that is specified by the attribute value.

toutc([outputformat][, inputformat])

Returns the date specified by the attribute value that is converted to UTC and formatted as specified by the outputformat parameter, if one was provided.

  • outputformat: The optional format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

utcnow([outputformat])

Returns the current system UTC date and time.

  • outputformat: The optional format specifier. Valid specifiers include the following:

    • d (short date pattern)

    • D (long date pattern)

    • f (long date/short time pattern)

    • F (long date/time pattern)

    • g (general short date/time pattern)

    • G (general short date/long time pattern)

    • r or R (RFC1123 pattern)

    • s (sortable date/time pattern)

    • t (short time pattern)

    • T (long time pattern)

    • file (Microsoft Windows file time)

    • MM/dd/yy

weekday([inputformat])

Returns the day of the week as an integer, where Monday is 0 and Sunday is 6.

  • inputformat: The optional input format specifier. The default value is autodetected.

year([inputformat])

Returns the year component of the date that is represented by the attribute value.

  • inputformat: The optional input format specifier. The default value is autodetected.

Sample Date Formats

The list below shows sample date-format strings and how those formats render the following date/time: the day of July 25th, 2019; at the time 8 hours, 14 minutes, 22 seconds, and 5 milliseconds after midnight in the Eastern Standard time zone (UTC-5)

  • MM-dd-yy | 07-25-19

  • MM/dd/yyyy HH:mm | 07/25/2019 08:14

  • yyyy-MM-ddTHH:mm:ss | 2019-07-25T08:14:22

  • yyyy-MM-ddTHH:mm:ss.SSS (Java) | 2019-07-25T08:14:22.005

  • yyyy-MM-ddTHH:mm:ss.fff (Windows) | 2019-07-25T08:14:22.005

  • yyyy-MM-ddTHH:mm:ss ZZ | 2019-07-25T08:14:22 -5

  • ddd, dd MMM yyyy HH:mm:ss zzz | Thu, 25 Jul 2019 08:14:22 EST