Format Date and Time String
- Updated2023-02-17
- 3 minute(s) read
Format Date and Time String
Converts a timestamp or numeric value into a string that displays the corresponding time.
This node calculates date and time string by copying time format string and replacing each of the time format codes with the corresponding values.

Inputs/Outputs

time format string
Format of the output string.
The syntax for this string is %<optional #><format code>.
The # modifier removes the leading zeros from the output of %d, %H, %I, %j, %m, %M, %S, %U, %w, %W, %X, %y, %Y. By default, the output contains leading zeros as necessary to ensure a constant field width.
This node uses the following format codes to interpret timestamp:
Time Format Code | Definition | Values |
---|---|---|
%a | Abbreviated weekday name. This node returns a numeric value for systems that do not support abbreviated names, such as Chinese and Korean. | Sun - Sat |
%A | Full weekday name | Sunday - Saturday |
%b | Abbreviated month name. This node returns a numeric value for systems that do not support abbreviated names, such as Chinese and Korean. | Jan - Dec |
%B | Full month name | January - December |
%c | Locale-specific default date and time | |
%d | Day of month | 01-31 |
%H | Hour (24-hour clock) | 00-23 |
%I | Hour (12-hour clock) | 01-12 |
%j | Day number of the year | 001-366 |
%m | Month number | 01-12 |
%M | Minute | 00-59 |
%p | AM or PM flag | AM or PM |
%S | Second | 00-59 |
%<digit>u | Fractional seconds with <digit> precision | |
%U | Week number of the year, with the first Sunday as the first day of the first week | 00-53 |
%w | Weekday as a decimal number, with 0 representing Sunday | 0-6 |
%W | Week number of the year, with the first Sunday as the first day of the first week | 00-53 |
%x | Locale-specific date | |
%.1x | Long date format | |
%.2x | Abbreviated long date format. This node returns a numeric value for systems that do not support abbreviated names, such as Chinese and Korean. | |
%X | Locale-specific time | |
%y | Year within century | 00-99 |
%Y | Year, including the century | 1997, for example |
%z | Difference between locale time and universal time | HH:MM:SS |
%Z | Time zone name or abbreviation | |
Literal text | Literal text |
Default value: %c—Corresponds to the locale-specific date/time representation.

timestamp
The time that you want to convert.
The year in this timestamp must be between 1600 and 3000.
If you wire a numeric value to this input, the node interprets the number as the time-zone-independent number of seconds that have elapsed since 12:00 a.m. on January 1, 1904, Universal Time [01-01-1904 00:00:00]. The node interprets a negative number as the number of seconds before this time.
Default value: The current date and time

UTC format
Boolean value that specifies whether the output string is in Universal Time or in the configured time zone for the computer.
True | date and time string is in Universal Time. |
False | date and time string is in the configured time zone for the computer. |
Default value: False

date and time string
timestamp formatted by the code specified in time format string.