Date Formatters

Version 22.0.8483


Date Formatters

Version 22.0.8483


The following is a list of formatters that manipulate date/times. The syntax for all formatters is the same: attributes (variables) are “piped” in (using a vertical pipe character) to formatters from left-to-right, e.g.:

[attr | formatter1() | formatter2()]

The attribute piped into File Formatters should always be a date/time string. For example, if the attribute ‘myDate’ is set to a date/time in ‘YYYY-MM-dd’ format, then the following would return the value representing the day in that date:

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

Many Date Formatters have a parameters that specifies the input or output format for dates; a list of sample date formats is included at the bottom of the list for reference.


compare([value][, inputformat])

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

  • value: The optional string representation of the date that will be compared with the attribute value. Default is now.
  • inputformat: The optional input format specifier. Default is autodetected.

date([outputformat])

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

  • outputformat: The optional format specifier. Valid specifiers include 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 (Windows file time), MM/dd/yy, etc.

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 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 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(Windows file time), MM/dd/yy, etc.
  • inputformat: The optional input format specifier. Default is autodetected.

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

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

  • interval: The optional interval you want the result in. Specify day, hour, minute, second, or millisecond.
  • value: The optional string representation of the date to compare with attribute value. Default is now.
  • inputformat: The optional input format specifier. Default is autodetected.

day([inputformat])

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

  • inputformat: The optional input format specifier. Default is autodetected.

dayofweek([inputformat])

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

  • inputformat: The optional input format specifier. Default is autodetected.

dayofyear([inputformat])

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

  • inputformat: The optional input format specifier. Default 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 was provided.

  • outputformat: The optional output format specifier. Valid specifiers include 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 (Windows file time), MM/dd/yy, etc.

isleap([ifleap][, ifnotleap])

Returns true (or ifleap) if the 4-digit year represented by the attribute value is a leap year, false (or ifnotleap) otherwise.

  • ifleap: The optional value returned if the attribute value is a leap year.
  • ifnotleap: The optional value 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 represented by the attribute value.

  • inputformat: The optional input format specifier. Default is autodetected.

now([outputformat])

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

  • outputformat: The optional format specifier. Valid specifiers include 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 (Windows file time), MM/dd/yy, etc.

todate([outputformat][,inputformat])

Returns the date specified by the attribute value formatted as specified by the parameter if one was provided.

  • outputformat: The optional output format specifier. Valid specifiers include 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 (Windows file time), MM/dd/yy, etc.
  • inputformat: The optional input format specifier. Default is autodetected. The formatter will attempt to honor the input format when parsing date attributes, however, if the input attribute does not match the specified input format, the formatter will attempt to use known (standard) date formats to parse the input attribute. An error will only be raised 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. Default is autodetected.

tomonth()

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

toutc([outputformat][, inputformat])

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

  • outputformat: The optional format specifier. Valid specifiers include 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), and file (Windows file time), MM/dd/yy, etc.

utcnow([outputformat])

Returns the current system UTC date and time.

  • outputformat: The optional format specifier. Valid specifiers include 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 (Windows file time), MM/dd/yy, etc.

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. Default is autodetected.

year([inputformat])

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

  • inputformat: The optional input format specifier. Default is autodetected.

Sample Date Formats

Below is a list of sample date format strings, and how this format would 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-dd’T’HH:mm:ss | 2019-07-25T08:14:22
  • yyyy-MM-dd’T’HH:mm:ss.SSS (Java) | 2019-07-25T08:14:22.005
  • yyyy-MM-dd’T’HH:mm:ss.fff (Windows) | 2019-07-25T08:14:22.005
  • yyyy-MM-dd’T’HH: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