由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - parse Date in DateFormat
相关主题
JDK US DST Timezone Update Tool - 1.0问JavaFX的一个问题
读文件时,如何才能只将空白符当成分隔符?Re: XML help?
Re: how to set java run time locale/encoJavaCC/SableCC/otherCC ?
问一个eclipse的问题help! XML parse problem
timezone question (转载)java 1.4 直接处理 http?
DATE TIME In RDBMSJava XML parser的问题
ThreadLocal 的一个 use caseAnybody here used apache Lucene?
java and javascript 问题请教,有包子Java HTMLEditorKit 中取得html的text?
相关话题的讨论汇总
话题: australia话题: parse话题: est话题: dateformat话题: timezone
进入Java版参与讨论
1 (共1页)
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.

1 (共1页)
进入Java版参与讨论
相关主题
Java HTMLEditorKit 中取得html的text?timezone question (转载)
Java menu accelerator not workingDATE TIME In RDBMS
[转载] 这个是什么错误呀?ThreadLocal 的一个 use case
Question about tabjava and javascript 问题请教,有包子
JDK US DST Timezone Update Tool - 1.0问JavaFX的一个问题
读文件时,如何才能只将空白符当成分隔符?Re: XML help?
Re: how to set java run time locale/encoJavaCC/SableCC/otherCC ?
问一个eclipse的问题help! XML parse problem
相关话题的讨论汇总
话题: australia话题: parse话题: est话题: dateformat话题: timezone