Performs arithmetic on date, time, datetime, and interval values. In Advanced Expression mode, composite expressions involving datetimes and intervals may be constructed.
See also: Date/Time Terminology, Date/Time Format, Date/Time Functions
The DateTimeCalculator performs arithmetic on five temporal types:
The input temporal strings must be in FME format.
If input strings are invalid but repairable, they will be auto repaired. For example, in a date string, month = 13 will cause the year to be incremented by 1, and month set to 01.
DateTimeCalculator also supports interval arithmetic, where the interval can be specified in one of two ways:
Invalid temporal and interval input will cause date time functions that consume them to return null, and cause the feature to be rejected.
Limitations:
Accepts and processes features one by one. Temporal values and interval values can come from attributes.
Outputs valid results.
Outputs invalid results, which are set to null. When features come out of this port, please check if the input strings are valid syntactically, and then if they are valid semantically.
Specifies the operation to perform:
Specify a starting temporal value. Choose whether to add or subtract an interval. Then, specify values for the interval parts of interest. The interval parts supported are years, months, days, hours, minutes, and seconds. The seconds parameter can be fractional. The other part values must be integers.
Note: Float values for integer-only fields are rounded into integers.
Specify a starting temporal value. Choose whether to add or subtract an interval. Then, specify the interval with ISO 8601 duration format.
Specify start and end temporal values. Then, pick the output interval type. Supported interval types are:
Note: To re-use fractional years, months, weeks, days, hours, or minutes in a DateTimeCalculator or @DateTimeAdd(), please round or truncate the fractional values into integers first.
Tip: Fractional years, months, weeks, days, hours, minutes, or seconds as the output interval type may be useful for comparison and reporting.
Construct composite FME expressions involving datetime, for example:
Please see FME Date/Time Functions.
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Search for samples and information about this transformer on the FME Knowledge Center.