i trying use java.time.format.datetimeformatter parse dates "2017-04-03 19:16:19 etc/gmt" , getting java.time.format.datetimeparseexception: text '2017-04-03 19:16:19 etc/gmt' not parsed @ index 20
here how formatter being initialized:
datetimeformatter formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss zzz");
at same time, if date follows: "2017-04-03 19:16:19 etc/utc", works great.
i checked java.time.zoneid.getavailablezoneids()
- string "etc/gmt" in list (technically, in set).
any ideas?
use datetimeformatter
pattern "yyyy-mm-dd hh:mm:ss vv"
:
v time-zone id zone-id america/los_angeles; z; -08:30 z time-zone name zone-name pacific standard time; pst
as can see, v
pattern format/parse zone id, america/los_angeles
, etc/gmt
, while z
pattern formats/parses zone name.
the v
pattern must @ least 2 long, i.e. vv
.
Comments
Post a Comment