l**s 发帖数: 28 | 1 the following code generates the result as:
Current TimeZone:America/New_York
before parse:2003-11-15 16:42:05 EST
after parse:2003-11-15 16:42:05 EST
Timezone change to:Australia/Sydney
before parse:2003-11-16 08:42:05 EST
after parse:2003-11-16 09:42:05 EST
it had 1 hour different in Australia/Sydney timezone(called EST too) before
and after the parsing.
could someone please tell me why?
Thanks.
=================================================================
import java.util.TimeZone;
impo |
l**s 发帖数: 28 | 2 BTW, the problem happens only in the Australia TimeZones
Australia/Adelaide
Australia/Broken_Hill
Australia/South
Australia/Yancowinna
AET
Australia/ACT
Australia/Canberra
Australia/Hobart
Australia/Melbourne
Australia/NSW
Australia/Sydney
Australia/Tasmania
Australia/Victoria
right now it's summer there and they use DayLightSaving time, so it might be
somewhere messed up when handling the DST in Australia.
【在 l**s 的大作中提到】 : the following code generates the result as: : Current TimeZone:America/New_York : before parse:2003-11-15 16:42:05 EST : after parse:2003-11-15 16:42:05 EST : Timezone change to:Australia/Sydney : before parse:2003-11-16 08:42:05 EST : after parse:2003-11-16 09:42:05 EST : it had 1 hour different in Australia/Sydney timezone(called EST too) before : and after the parsing. : could someone please tell me why?
|
l**s 发帖数: 28 | 3 Australia starts DST on the last Sunday in October
the parse works fine if in standard time(non-DST) in Australia timezone
【在 l**s 的大作中提到】 : BTW, the problem happens only in the Australia TimeZones : Australia/Adelaide : Australia/Broken_Hill : Australia/South : Australia/Yancowinna : AET : Australia/ACT : Australia/Canberra : Australia/Hobart : Australia/Melbourne
|
m******t 发帖数: 2416 | 4
I'm not sure DateFormat handles daylight saving times.
You might want to look into Calendar, and more specifically,
GregorianCalendar. The javadoc of GregorianCalendar has some interesting
discussion and example on how to handle the daylight saving time offset.
【在 l**s 的大作中提到】 : Australia starts DST on the last Sunday in October : the parse works fine if in standard time(non-DST) in Australia timezone
|
l**s 发帖数: 28 | 5 thanks.
DateFormat should handle DST, it has a TimeZone with it.
I think the problem will be either DateFormat.format() returns wrong string
or DateFormat.parse() returns wrong date, It might be a Java bug,since
it only happens in Australia TimeZones.
【在 m******t 的大作中提到】 : : I'm not sure DateFormat handles daylight saving times. : You might want to look into Calendar, and more specifically, : GregorianCalendar. The javadoc of GregorianCalendar has some interesting : discussion and example on how to handle the daylight saving time offset.
|
B**z 发帖数: 153 | 6 see Java bug database bug ID # 4856901, status:in progress
last updated on 2003-11-06.
【在 l**s 的大作中提到】 : thanks. : DateFormat should handle DST, it has a TimeZone with it. : I think the problem will be either DateFormat.format() returns wrong string : or DateFormat.parse() returns wrong date, It might be a Java bug,since : it only happens in Australia TimeZones.
|