Step: Normalize Date

This step converts a date from one format to another, either automatically choosing from a set of built-in patterns, or from one you specify. The output format can also be specified by you.

Operates on table variable values

Allows Freemarker templates to reference values

  • Input Value: A Freemarker expression of the value from the package table you want to convert (typically from a Query Package step).
  • Output Variable: The name you want to give the resulting date.
  • Replace Input Variable: Check the box to replace the Input Variable instead of creating a new one.
  • Matching Options:
    • Automatic pattern match: Tries all internal common date patterns and uses the first one that matches.
    • Use only this pattern: Only tries the pattern entered into the box. Uses Java date codes (see below)
    • Try this pattern first then use automatic: A combination of the previous two options. Tries the entered pattern first, and if no match, tries the automatic pattern match.
  • Output Pattern: When the incoming pattern is recognized, specify the pattern to use when creating the output. Uses Java date codes (see below)
  • Step Options:
    • Exit Step on False side if no match: When checked, if the date cannot be matched and converted, the package will continue through the False path of the step. If this is left unchecked and the date cannot be matched, the package will be discarded.

Upgrade Notice from 3.5 to 3.6

The FreeMarker output of this step only outputs single (scalar) values now. This means that if you were using a "Replace Input Variable" checkbox and the input was a list (${sample[0]}) or a table (${sample[0][0]}) you will need to uncheck the Replace checkbox and enter in a new variable name that will output as a single value (${sample}). Then any following steps will need to be updated to use the new variable name and format.

Use the Steps in Playbook view to find the playbooks that use this step. The view can be found in the menu Window → Show View

Date Codes (MM/dd/yyyy)

Substitute date and time components with their corresponding letters. Use multiple letters to represent multiple values. Wrap single-quotes around any letters in the date that should be ignored. Important: If you do not specify a time zone in your date, it will show up in local time to the DarkLight server. If you need to, use the Replace Text step to add -0000 to the end of your existing UTC date.

For Example
2001-07-04T12:08:56.235-0700 is represented as
yyyy-M-d'T'HH:mm:ss.SSSZ (RFC 822)

2017-09-12T22:51:45.600-07:00 is represented as
yyyy-M-d'T'HH:mm:ss.SSSXXX ( Note: ISO 8601 is the default and recommended pattern for DarkLight dates)

Letter Date or Time Component Examples
yy; yyyy Year 96; 1996
M; MMM; MMMM Month in year 7 or 07; Jul; July
d Day in month 10
EEE; EEEE Day in week Tue; Tuesday
a Am/pm marker PM
H Hour in day (0-23) 0
h Hour in am/pm (1-12) 12
m Minute in hour 30
s Second in minute 55
S Millisecond 978
z RFC Time zone Pacific Standard Time; PST; GMT-08:00
Z RFC 822 Time zone -0800
X; XX: XXX ISO 8601 Time zone -08; -0800; -08:00
—————– ————————- ————————
epoch Unix time in seconds 1528927247

Notes: Components that can be spelled out, like months, days, and time zone, should use the number of letters to use in the abbreviation, or 4 letters to represent the whole word. For example: M=8 or 08, MMM=Aug, MMMM=August.

  • UNIX time (epoch time) can be used as a pattern to match in the Normalize Date step by entering the word epoch

See Also: DateTimeFormatter pattern documentation

The following patterns are tried by DarkLight anywhere automatic pattern matching is used. Examples include the Normalize Date step and Reification.

  • MM/dd/yy
  • MM/dd/yy HH:mm:ss
  • yy-MM-dd HH:mm:ss
  • dd MMM yy HH:mm:ss
  • 'P' ddHHmm'Z' MMM yy
  • MMMM dd, yy HH:mm
  • E, dd MMM yy
  • dd-MMM-yy
  • yy-MM-dd
  • dd MMM yy
  • yy/MM/dd hh:mm:ss a
  • yy/MM/dd HH:mm:ss
  • dd MMM, yy
  • EEEEE MMM dd, yy HH:mm:ss
  • dd/HHmm'Z' MMM yy
  • 'R' ddHHmm'Z' MMM yy
  • EEEEE, MMMMM dd, yy hh:mm a
  • MMM yy
  • dd-MMM-yy
  • EEE MMM dd, yyyy - HH:mm:ss
  • EEE, dd MMM yy HH:mm:ss
  • EEEEE, MMMMM dd, yy
  • yyyyMMdd
  • yyMMdd HHmm
  • yyMMdd hhmm a
  • MM/dd/yy HH:mm
  • MM/dd/yy hh:mm a
  • dd-MMMM-yy HH:mm
  • dd-MMMM-yy hh:mm a
  • yyMMdd
  • EEEEE,MMMMMM dd, yyyy
  • MMMM yy
  • EEE MMM dd HH:mm:ss zzz yyyy
  • MM-dd-yyyy
  • yyyyMMdd HHmm
  • yyyyMMdd hhmm a
  • MM/dd/yyyy hh:mm:ss a
  • MMMM dd, yyyy
  • MMMM dd, yy
  • yyyy-MM-dd HH:mm:ss a
  • yyyy-MM-dd'T'HH:mm:ss.SSSXXX
  • yyyy-MM-dd'T'HH:mm:ss.SSSX
  • yyyy-MM-dd'T'HH:mm:ssX
  • yyyy-MM-dd'T'HH:mm:ss
  • yyyy-MM-dd'T'HH:mm:ssz
  • yyyy-MM-dd'T'HH:mm:ss.SSS

(Version 3.6+) Additionally, Epoch (Unix) time is also tried, and will match either millisecond versions or seconds version. Unix time matching works on numbers and numbers expressed in scientific notation.

Nerdy Note: Unix time in seconds will only match dates after March 3, 1970 (when it flipped from an 8-digit to a 9-digit number) because 8-digit numbers will be matched by the yyyyMMdd pattern first.

  • step/normalize-date
  • Last modified: 2018/10/30 15:30