Date/Time format
-
Hi all,
I am having some trouble parsing a date/time stamp from a http retriever data source. The regex appears to be working as it is getting the correct raw data but no mater what i put into the Time Format field I either get an error " 'Portlaoise Weather': Failed to parse time "2020-04-27T11:55:06" for Portlaoise Weather - Temperature" or if I only put yyyyMMdd in to the Time format field i get the wrong date of "2019-12-04" returned.
What should I enter in the Time Format field to get 2020-04-27 11:55:06 for the data/timestamp above?
Thanks. -
Hi Rob
Did you try changing the time capture group to 1?
-
Hi @CraigWeb. Yes I tried both 0 and 1 for the capture group.
-
This should do the trick if your time regex is working.
yyyy-MM-dd'T'hh:mm:ss
-
Thanks @CraigWeb. Well don't i feel like an idiot! Not sure where I was going wrong, I thought that's how I had it but when I copied your format in and it worked first time. Thanks again.
Edit: Just as a matter of interest - If it was unix time what would the format be?
-
@robmalone
(\d+) => digit plus all the following characters straight after that are the same assuming this is regex and not a timestamp format
Just realised this is using the SimpleDateFormat Library. According to docs you can useepoch
https://help.sumologic.com/03Send-Data/Sources/04Reference-Information-for-Sources/Timestamps%2C-Time-Zones%2C-Time-Ranges%2C-and-Date-Formats#Timestamp_conventions -
Thanks @MattFox