Timestamp Facets


#1

Hello, I have a CSV file with a time stamp in the following format “2020-01-21T14:00:00-04:00”, I have not been able to find a Facets time format that works. I have tried many formats but cannot figure out what to do with the “T”. YYYY-MM-DDTHH:mm:ss-hh:mm

I always get the following error Unparseable date: “2020-01-21T14:00:00-04:00”

Any suggestions would be appreciated

Thanks


#2

Looks like you are using ISO 8601 time format and having issues with your timezone formatting as well as the the usage of the “T”.

Using the javadocs on this formatting found here:
https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html

It appears you want to use the ‘X’ to handle this formatting.

X Time zone ISO 8601 time zone -08 ; -0800 ; -08:00

And then single quote the T to essentially ignore it.

So you should be able to get a good result with:

YYYY-MM-DD’T’HH:mm:ssX