Skip to main content

Hi,

I have a fairly basic script, a reader, an attribute creator to create new attributes, and a writer.

I want the attribute creator to calculate a date column by adding 8 hours to a value from an existing date column.

I am an FME newbie and would love some suggestions.

Thanks!

Hi @okgirl, a possible way with regular transformers is:

  1. DateFormatter: Format the date value in the %s format - the elapsed seconds since the epoch.
  2. Add 28800 seconds (= 8 hours x 3600 sec) to the value with the ExpressionEvaluator (or AttributeCreator or AttributeManager).
  3. DateFormatter_2: Re-format the value in the original date format.

See the help on the DateFormatter transformer to learn more about the Date Format Symbols.

Alternatively, the DateTimeCalculator from the FME Hub might also be available.


[clock format [expr [clock scan now] +28800]]

in case u do wish to do it in a AttributeCreator

if needed u can add format strings like in DateFormatter using -format {%d-%m-%Y}

check tcl site for usage.


Reply