Time Formatter
The Time Formatter action formats a TIMESTAMP variable into a STRING variable in several standard formats, including custom formats.
Parameter descriptions
Parameter | Description |
---|---|
Format | This is the output format in which
you want the date and time information
to appear. Select a format from the
list. The options are:
|
Append Milliseconds | The options are:
|
Use Advanced Properties | Select the Use Advanced
Properties check box to
display additional parameters:
ArraySize,
Use GMT time and Set
Timezone. The Set
Timezone parameter will appear
when the Use GMT time
is set to False,
and when the Staging Browser folder
/system/zoneinfo exists. |
Array Size | Used when there is an array of data
type TIMESTAMP that must be converted
to an array of STRING. If the input variable is a single TIMESTAMP variable, enter the size of 1. |
Use GMT time | Used to specify that the output
variable will be in Greenwich Mean Time
(GMT). The options are:
|
Set Timezone |
When the Use GMT time is set to False, and when the Staging Browser folder /system/zoneinfo exists, the Set Timezone parameter will appear. The options are:
|
Timezone files
When using an alternate timezone, meaning not the timezone configured for the gateway and not GMT; timezone files must be present in the Staging Browser /system/zoneinfo/ folder.
These timezone files can be an entire set of files for many timezones, or a subset of files for only the few timezones that apply to your gateways and your solution.
A compressed file of timezone files as well as the corresponding uncompressed folder is available from the Management Portal in the Developer -> Resources area. For more information, see Resources.
Once the compressed file is downloaded from the Resources area, it can be uncompressed and the entire set of files, or a subset of the files, can be transferred to the gateway's Staging Browser area. For more information, see Staging Browser.
The folder and file structure from the uncompressed file should be maintained.
Input tab
The Input tab when the Set Timezone
parameter is False, or otherwise not
available:
The Input tab when the Set Timezone
parameter is True:
Parameter | Description |
---|---|
Timestamp | The input TIMESTAMP to convert to a String |
Count to Parse | The number of items in the array to format (this can be less than the maximum array size). |
Timezone | Used to specify the Timezone
in which you want the date and time
information to appear. This field is
only enabled when the Set Timezone field is set to True. The filename or path to the timezone file relative to Staging Browser /system/zoneinfo/ folder. The input must be a String format. For example:
Note: When specifying this input field and selecting a format that contains the %Z (custom or RFC8339), the output string will present the timezone as "Z or GMT" even though the time will be in the specified timezone. |
Output tab
Parameter | Description |
---|---|
Output | The output STRING variable with the
date and time formatting specified by
the Format
parameter. Specifying a string that is greater than 64 characters long guarantees that all string formats can be accommodated. |
Exporting a trigger with reference to a timezone file
When you export a trigger, or do a Back Up using the Workbench -> Back Up function, the timezone file referenced by the trigger Time Formatter action is not included in the export (or Back Up).
The timezone files must be copied onto any new node, in the Staging Browser /system/timezone folder, that gets the import of the exported trigger (or a Restore from the Back Up).
Adding a Custom format
The Time Formatter action also lets you
define a Custom format for the output
string. A maximum of 9 format codes can be defined in the
custom format.
You can add a Custom format as
follows:
- From the bottom of the Actions
tab, select Add.
The New Action window appears. - Expand the String category, select
TimeFormatter, and
then select Add.
The right pane changes to accommodate a Time Formatter action. - Next to Format, select the
down-arrow, and then select
Custom.
The CustomFormat box becomes available.
The Custom format will be a string that contains format codes for the strftime() function to replace with runtime values. - In the Custom Format box, type the format to use for the timestamp output variable.
strftime function formats
The strftime() function converts the date and time
information to a format specified by each format code and
then stores the result in a string (up to the maximum size
of characters).
Note: You must supply valid format codes
for the C runtime library strftime() function and operating
system environment. Incorrect format codes may cause
runtime problems.
The following format codes can be used:
Code | Replaced by | Example |
---|---|---|
%a | The abbreviated weekday name. * | Fri |
%A | The full weekday name. * | Friday |
%b | The abbreviated month name. * | Oct |
%B | The full month name. * | October |
%c | The standard date and time string. | Thu Aug 23 14:55:02 2019 |
%d | The day of the month as a number (01-31). | 23 |
%H | The hour in 24-hour format (00-23). | 14 |
%I | The hour in 12-hour format (01-12). | 02 |
%j | The day of the year as a number (001-366). | 235 |
%m | The month as a number (01-11). | 08 |
%M | The minute as a number [00-59]. | 55 |
%p | The locale's equivalent of a.m. or p.m. | PM |
%S | The second as a number (00-59). | 02 |
%U | The week of the year (Sunday as the first day of the week) as a number (00-53). | 33 |
%w | The weekday as a number (0-6), with 0 representing Sunday. | 4 |
%W | The week number of the year (Monday as the first day of the week) as a number (00-53). All days in a new year preceding the first Monday are considered to be in week 0. | 34 |
%x | The standard date representation. * | 08/23/19 |
%X | The standard time representation. * | 14:55:02 |
%y | The year in decimal without the century (00-99). | 01 |
%Y | The year in decimal with the century. | 2019 |
%z | The +hhmm or -hhmm numeric timezone (that is, the hour and minute offset from UTC). (SU) | -0400 |
%Z | The time zone name or abbreviation. | CDT |
%% | A percent (%) sign. | % |
* Indicates Locale dependent.