Select to view content in your preferred language

Not able to get Input String Date values to map or calc to Date Output Field

257
2
04-11-2024 04:06 PM
316353
by
New Contributor

I am having a hard time getting a simple input string field (which is a date) from a CSV file that is in the following format:  "3/7/2024 12:39:42.784 PM" to map to an awaiting output definition as a date field.

Writing from input to output as String ... JSON output, works just fine.  But, any time I try to write to a GeoEvent Def that has a date field to hold this data - I get NULL results.  I've looked through many of the  link available via the Esri community and no luck.  I've tried adding this calc: replaceAll(Field3, '(\d+)[/](\d+)[/](\d+)', '$3-$1-$2T00:00:00') ... and it works until I apply it to an awaiting date field.  I've tried setting the date format for the Input CSV.

Any guidance is greatly appreciated.

0 Kudos
2 Replies
DominicRoberge2
Occasional Contributor III
0 Kudos
RJSunderman
Esri Regular Contributor

Have you read through the examples in the thread:
 Timestamps received from a sensor feed display differently in GeoEvent Sampler, ArcGIS REST Services... 

I think your expression replaceAll(myField, '(\d+)[/](\d+)[/](\d+)', '$3-$1-$2T00:00:00') may be taking the value "3/7/2024 12:39:42.784 PM" and producing the value "2024-3-7T00:00:00 12:39:42.784 PM". Two problems with that are the month and day lost their leading zeros and the ISO 8601 format you're trying to create has unwanted characters from the original time appended to the tail of the string.

If you are OK with GeoEvent Server assuming the value "3/7/2024 12:39:42.784 PM" is local server time, you could edit the GeoEvent Definition  your input is using adapt the date/time string to specify the value be adapted as a Date and specify the input apply MM/dd/yyyy hh:mm:ss.SSS aa as the Expected Date Format parameter. Using this formatting string to "teach" the input how to parse your date/time string, I was able to adapt the string "3/7/2024 12:39:42.784 PM" as an epoch value 1709843982784.  I could then use a Field Mapper to cast this Date value to a String "Thu Mar 07 12:39:42 PST 2024" to double-check the data was adapted properly.

-- RJ

0 Kudos