java - Why isn't this timezone being set correctly? -
given next (android) code:
calendar cal = calendar.getinstance(); system.out.println(cal.gettimezone().tostring()); cal.settimezone(timezone.gettimezone("america/new york")); system.out.println(cal.gettimezone().tostring());
i next output:
sun.util.calendar.zoneinfo[id="europe/london",offset=0,dstsavings=3600000,usedaylight=true,transitions=242,lastrule=java.util.simpletimezone[id=europe/london,offset=0,dstsavings=3600000,usedaylight=true,startyear=0,startmode=2,startmonth=2,startday=-1,startdayofweek=1,starttime=3600000,starttimemode=2,endmode=2,endmonth=9,endday=-1,enddayofweek=1,endtime=3600000,endtimemode=2]] sun.util.calendar.zoneinfo[id="gmt",offset=0,dstsavings=0,usedaylight=false,transitions=0,lastrule=null]
why isn't america\new york
timezone beingness set?
try this: cal.settimezone(timezone.gettimezone("america/new_york"));
not sure yet think wrong timezone id might problem.
see also: http://tutorials.jenkov.com/java-date-time/java-util-timezone.html
java android timezone
No comments:
Post a Comment