Skip to main content
Question

Convert FME datetime to Epoch with milliseconds

  • February 5, 2021
  • 1 reply
  • 229 views

bgeorges
Contributor
Forum|alt.badge.img+5

I am reading a feature class stored in ArcGIS Enterprise database and I would like to output a json file.

 

However, I need the datetime fields values to be in epoch time (with milliseconds) not in FME datetime format.

 

I am using the DateTimeConverter transformer with the %s Output format parameter

 

For instance I need this translation

 

2021020511442300 ---> 1612543463000

 

However the transformer return the following error:

DateTimeConverter: Failed to evaluate expression '@DateTimeFormat(20210127152551,%s)'. Result is set to null

Format flag '%s' is not supported for input type 'datetime'. Please check @DateTimeFormat() documentation in https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/!Transformer_Parameters/Date-Time-Functions.htm in the subsections 'Arguments' and 'Format String Flags', for supported flags and exclusion lists

 

 

 

1 reply

Forum|alt.badge.img+2
  • February 5, 2021

@bgeorges​  You need decimal seconds. Your input date string:

2021020511442300

has 00 as decimal seconds but no decimal point. Either strip the trailing 00 with StringReplacer, or slip in a DateTimeConverter with a format string %Y%m%d%H%M%S00


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings