parsing - Java SimpleDateFormat parse Timezone like America/Los_Angeles -


i want parse following string in java , convert date:

dtstart;tzid=america/los_angeles:20140423t120000 

i tried this:

simpledateformat sdf = new simpledateformat("'dtstart;tzid='z':'yyyymmdd't'hhmmss"); date start = sdf.parse("dtstart;tzid=america/los_angeles:20140423t120000"); 

and this:

simpledateformat sdf = new simpledateformat("'dtstart;tzid='z':'yyyymmdd't'hhmmss"); date start = sdf.parse("dtstart;tzid=america/los_angeles:20140423t120000"); 

but still doesn't work. think problem in america/los_angeles. can me please?

thank you

try 1 using timezone.

note: have split date string before doing operation.

    simpledateformat sdf = new simpledateformat("yyyymmdd't'hhmmss");      timezone tz = timezone.gettimezone("america/los_angeles");     sdf.settimezone(tz);      date start = sdf.parse("20140423t120000"); 

in simpledateformat pattern z represent rfc 822 4-digit time zone

for more info have @ simpledateformat#timezone.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -