Java Time API converting ISO 8601 to ZonedDateTime -


i having hard time converting iso 8601 formatted string java.time.localdatetime in utc.

more specific, trying write xmladapter can enter various iso 8601 dataformats string (i.e. 2002-09-24, 2011-03-22t13:30, 2015-05-24t12:25:15z, 2015-07-28t11:11:15.321+05:30) , outputs localdatetime in utc , visa versa.

the system stores it's date , time information internal in utc times. when user requests date or time represented user based on own zoneid.

as name suggests localdatetime holds both date , time. first example of date string have in question example holds information date, therefore cannot parse directly localdatetime. there first parse localdate , setting time on object localdatetime.

localdatetime localdatetime = localdate.parse("2002-09-24").atstartofday(); 

all date , time objects have parse method localdate can take string format. these formats different iso standard formats specified in datetimeformatter

for formatting custom datetime strings temporal objects use datetimeformatter , specify custom pattern.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -