I'm querying a Postgres database and looking for the best way to store a Postgres "timestamp with timezone" information.
the format is "yyyy-MM-dd' 'HH:mm:ss.SSSzz" (i.e. "2014-04-22 05:39:49.916+03")
i'd like to use a timestamp oriented type/class to keep the info (not String)
the following throws Unparsable date for all the TIME_FORMATS
i could think of:
final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSSz";
final SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
final java.util.Date utilDate = sdf.parse("2014-04-22 05:39:49.916+03");
Your format is having ISO Timezone
, so use X
(not z).
final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSSX";
More Info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With