- The DateTime variable type holds the representation of a date and/or time in the format of the number of milliseconds since January 1, 1970. This variable type is currently supported in the new transformation engine only.
-
You can safely manipulate date-time values in your data without the need for manual editing or custom rules to do so.
-
The Move rule (version 2) automatically converts the date into DateTime format (for EDI and Database).
-
In conjunction with this variable type, several Ruleset Actions support the DateTime variable type.
Creating a DateTime Variable
These steps take place in the Ruleset editor's Variables section.- Click Add Variable.
- Type the name you wish to give the variable.
- Select DateTime from the Type drop-down.
- Click OK to complete this task.
Result: The new variable now appears (identified as ) as an option in the Variables pane.
Example
This simple example shows how you might use a DateTime variable with several Actions. We will use the DateTime variable to set an initial value for a specific date - 12192000. We will then take that variable and add one day using another action. Finally we will format and write the output.
Three Actions will accomplish this:- CreateDateTimeFromString
- AddDateTimeWithFields
- FormatDateTime
But first we must create the DateTime variable from the Ruleset editor.
This variable, named "DT", is now available for use from the Variables pane.
Action: CreateDateTimeFromString
- Define Inputs (12192000)
- Define the pattern (mmddyyyy)
- Use "DT" as output.
Action: AddDateTimeWithFIelds
- Define inputs, using "DT"
- For DayOfMonth, define as “1”. For this example, we are simply adding one day to the initial DateTime.
- Again, use "DT" as output.
Action: FormatDateTime
- Define inputs, using "DT".
- Define the pattern. (mmddyyyy)
- Write the string out to target.
Now that we have our three Action used as Rule in the Ruleset, we can run the transformation and test the output.
Result: Initial source DateTime of 12192000 is written to target (Field 1) as 12202000.
Comments
0 comments
Please sign in to leave a comment.