I have a database field that contains a raw date field (stored as character data), such as
我有一个数据库字段,其中包含一个原始日期字段(存储为字符数据),如
Friday, September 26, 2008 8:30 PM Eastern Daylight Time
2008年9月26日星期五东部夏令时间晚上8:30
I can parse this as a Date easily, with SimpleDateFormat
我可以使用SimpleDateFormat轻松地将其解析为Date
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
Date scheduledDate = dbFormatter.parse(rawDate);
What I'd like to do is extract a TimeZone object from this string. The default TimeZone in the JVM that this application runs in is GMT, so I can't use .getTimezoneOffset()
from the Date
parsed above (because it will return the default TimeZone).
我想要做的是从该字符串中提取TimeZone对象。此应用程序运行的JVM中的默认TimeZone是GMT,因此我不能使用上面解析的Date中的.getTimezoneOffset()(因为它将返回默认的TimeZone)。
Besides tokenizing the raw string and finding the start position of the Timezone string (since I know the format will always be EEEE, MMMM dd, yyyy hh:mm aa zzzz
) is there a way using the DateFormat/SimpleDateFormat/Date/Calendar API to extract a TimeZone object - which will have the same TimeZone as the String I've parsed apart with DateFormat.parse()
?
除了标记原始字符串并找到时区字符串的起始位置(因为我知道格式将始终是EEEE,MMMM dd,yyyy hh:mm aa zzzz)有一种使用DateFormat / SimpleDateFormat / Date / Calendar API的方法提取一个TimeZone对象 - 它与我用DateFormat.parse()解析的字符串具有相同的TimeZone?
One thing that bugs me about Date
vs Calendar
in the Java API is that Calendar
is supposed to replace Date
in all places... but then they decided, oh hey let's still use Date
's in the DateFormat
classes.
在Java API中,有关日期与日历的错误之处在于Calendar应该在所有地方替换Date ...但是他们决定,哦,嘿,我们仍然在DateFormat类中使用Date。
7 个解决方案
#1
2
I found that the following:
我发现了以下内容:
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
dbFormatter.setTimeZone(TimeZone.getTimeZone("America/Chicago"));
Date scheduledDate = dbFormatter.parse("Friday, September 26, 2008 8:30 PM Eastern Daylight Time");
System.out.println(scheduledDate);
System.out.println(dbFormatter.format(scheduledDate));
TimeZone tz = dbFormatter.getTimeZone();
System.out.println(tz.getDisplayName());
dbFormatter.setTimeZone(TimeZone.getTimeZone("America/Chicago"));
System.out.println(dbFormatter.format(scheduledDate));
Produces the following:
产生以下内容:
Fri Sep 26 20:30:00 CDT 2008
Friday, September 26, 2008 08:30 PM Eastern Standard Time
Eastern Standard Time
Friday, September 26, 2008 08:30 PM Central Daylight Time
I actually found this to be somewhat surprising. But, I guess that shows that the answer to your question is to simply call getTimeZone on the formatter after you've parsed.
我实际上发现这有点令人惊讶。但是,我想这表明您的问题的答案是在解析后简单地在格式化程序上调用getTimeZone。
Edit: The above was run with Sun's JDK 1.6.
编辑:上面是使用Sun的JDK 1.6运行的。
#2
1
@Ed Thomas:
I've tried something very similar to your example and I get very different results:
我尝试过与你的例子非常相似的东西,结果非常不同:
String testString = "Friday, September 26, 2008 8:30 PM Pacific Standard Time";
DateFormat df = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
System.out.println("The default TimeZone is: " + TimeZone.getDefault().getDisplayName());
System.out.println("DateFormat timezone before parse: " + df.getTimeZone().getDisplayName());
Date date = df.parse(testString);
System.out.println("Parsed [" + testString + "] to Date: " + date);
System.out.println("DateFormat timezone after parse: " + df.getTimeZone().getDisplayName());
Output:
The default TimeZone is: Eastern Standard Time
默认TimeZone为:东部标准时间
DateFormat timezone before parse: Eastern Standard Time
解析前的DateFormat时区:东部标准时间
Parsed [Friday, September 26, 2008 8:30 PM Pacific Standard Time] to Date: Sat Sep 27 00:30:00 EDT 2008
解析[太平洋标准时间2008年9月26日星期五晚上8点30分]日期:2008年9月27日星期六00:30:00
DateFormat timezone after parse: Eastern Standard Time
解析后的DateFormat时区:东部标准时间
Seems like DateFormat.getTimeZone()
returns the same TimeZone before and after the parse()
... even if I throw in an explicit setTimeZone()
before calling parse()
.
看起来像DateFormat.getTimeZone()在parse()之前和之后返回相同的TimeZone ...即使我在调用parse()之前抛出一个显式的setTimeZone()。
Looking at the source for DateFormat and SimpleDateFormat, seems like getTimeZone()
just returns the TimeZone of the underlying Calendar... which will default to the Calendar of the default Locale/TimeZone unless you specify a certain one to use.
查看DateFormat和SimpleDateFormat的源代码,似乎getTimeZone()只返回基础Calendar的TimeZone ...除非您指定要使用的某个日历,否则将默认为默认Locale / TimeZone的Calendar。
#3
1
I recommend checking out the Joda Time date and time API. I have recently been converted to a believer in it as it tends to be highly superior to the built-in support for dates and times in Java. In particular, you should check out the DateTimeZone class. Hope this helps.
我建议查看Joda Time日期和时间API。我最近已经转变为信徒,因为它往往高度优于Java中日期和时间的内置支持。特别是,您应该查看DateTimeZone类。希望这可以帮助。
#4
1
tl;dr
ZonedDateTime.parse(
"Friday, September 26, 2008 8:30 PM Eastern Daylight Time" ,
DateTimeFormatter.ofPattern( "EEEE, MMMM d, uuuu h:m a zzzz" )
).getZone()
java.time
The modern way is with the java.time classes. The Question and other Answers use the troublesome old legacy date-time classes or the the Joda-Time project, both of which are now supplanted by the java.time classes.
现代的方法是使用java.time类。问题和其他答案使用麻烦的旧遗留日期时间类或Joda-Time项目,这两个现在都被java.time类取代。
Define a DateTimeFormatter
object with a formatting pattern to match your data.
使用格式设置模式定义DateTimeFormatter对象以匹配您的数据。
DateTimeFormatter f = DateTimeFormatter.ofPattern( "EEEE, MMMM d, uuuu h:m a zzzz" );
Assign a Locale
to specify the human language of the name-of-day and name of month, as well as the cultural norms for other formatting issues.
指定区域设置以指定日期名称和月份名称的人类语言,以及其他格式问题的文化规范。
f = f.withLocale( Locale.US );
Lastly, do the parsing to get a ZonedDateTime
object.
最后,进行解析以获取ZonedDateTime对象。
String input = "Friday, September 26, 2008 8:30 PM Eastern Daylight Time" ;
ZonedDateTime zdt = ZonedDateTime.parse( input , f );
zdt.toString(): 2008-09-26T20:30-04:00[America/New_York]
You can ask for the time zone from the ZonedDateTime
, represented as a ZoneId
object. You can then interrogate the ZoneId
if you need more info about the time zone.
您可以从ZonedDateTime请求时区,表示为ZoneId对象。如果您需要有关时区的更多信息,则可以询问ZoneId。
ZoneId z = zdt.getZone();
See for yourself in IdeOne.com.
在IdeOne.com中亲眼看看。
ISO 8601
Avoid exchanging date-time data in this kind of terrible format. Do not assume English, do not accessorize your output with things like the name-of-day, and never use pseudo-time-zones such as Eastern Daylight Time
.
避免以这种糟糕的格式交换日期时间数据。不要假设英语,不要使用诸如日常名称之类的东西来装饰您的输出,也不要使用诸如Eastern Daylight Time之类的伪时区。
For time zones: Specify a proper time zone name in the format of continent/region
, such as America/Montreal
, Africa/Casablanca
, or Pacific/Auckland
. Never use the 3-4 letter abbreviation such as EST
or IST
as they are not true time zones, not standardized, and not even unique(!).
对于时区:以洲/地区的格式指定适当的时区名称,例如America / Montreal,Africa / Casablanca或Pacific / Auckland。切勿使用3-4字母缩写,例如EST或IST,因为它们不是真正的时区,不是标准化的,甚至不是唯一的(!)。
For serializing date-time values to text, use only the ISO 8601 formats. The java.time classes use these formats by default when parsing/generating strings to represent their value.
要将日期时间值序列化为文本,请仅使用ISO 8601格式。在解析/生成字符串以表示其值时,java.time类默认使用这些格式。
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
java.time框架内置于Java 8及更高版本中。这些类取代了麻烦的旧遗留日期时间类,如java.util.Date,Calendar和SimpleDateFormat。
The Joda-Time project, now in maintenance mode, advises migration to java.time.
现在处于维护模式的Joda-Time项目建议迁移到java.time。
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
要了解更多信息,请参阅Oracle教程。并搜索Stack Overflow以获取许多示例和解释。规范是JSR 310。
Where to obtain the java.time classes?
从哪里获取java.time类?
-
Java SE 8 and SE 9 and later
- Built-in.
- Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
带有捆绑实现的标准Java API的一部分。
Java 9增加了一些小功能和修复。
-
Java SE 6 and SE 7
- Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
许多java.time功能都被反向移植到ThreeTen-Backport中的Java 6和7。
-
Android
- The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.
- See How to use….
ThreeTenABP项目特别适用于Android的ThreeTen-Backport(如上所述)。
请参阅如何使用....
Java SE 8和SE 9及更高版本内置。带有捆绑实现的标准Java API的一部分。 Java 9增加了一些小功能和修复。
Java SE 6和SE 7大部分java.time功能都被反向移植到ThreeTen-Backport中的Java 6和7。
Android ThreeTenABP项目专门针对Android调整ThreeTen-Backport(如上所述)。请参阅如何使用....
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
ThreeTen-Extra项目使用其他类扩展了java.time。该项目是未来可能添加到java.time的试验场。您可以在这里找到一些有用的课程,如Interval,YearWeek,YearQuarter等。
#5
0
Well as a partial solution you could use a RegEx match to get the timezone since you will always have the same text before it. AM or PM.
作为部分解决方案,您可以使用RegEx匹配来获取时区,因为您之前始终会有相同的文本。上午或下午。
I don't know enough about Java timezones to get you the last part of it.
我不太了解Java时区来获取它的最后一部分。
#6
0
The main difference between Date and Calendar is, that Date is just a value object with no methods to modify it. So it is designed for storing a date/time information somewhere. If you use a Calendar object, you could modify it after it is set to a persistent entity that performs some business logic with the date/time information. This is very dangerous, because the entity has no way to recognize this change. The Calendar class is designed for operations on date/time, like adding days or something like that.
Date和Calendar之间的主要区别在于,Date只是一个没有修改方法的值对象。所以它被设计用于在某处存储日期/时间信息。如果使用Calendar对象,则可以在将其设置为使用日期/时间信息执行某些业务逻辑的持久实体后对其进行修改。这非常危险,因为实体无法识别这种变化。 Calendar类专为日期/时间的操作而设计,例如添加天或类似的东西。
Playing around with your example I get the following:
玩弄你的例子,我得到以下内容:
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class TimeZoneExtracter {
public static final void main(String[] args) throws ParseException {
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
System.out.println(dbFormatter.getTimeZone());
dbFormatter.parse("Fr, September 26, 2008 8:30 PM Eastern Daylight Time");
System.out.println(dbFormatter.getTimeZone());
}
}
Output:
sun.util.calendar.ZoneInfo[id="Europe/Berlin"... sun.util.calendar.ZoneInfo[id="Africa/Addis_Ababa"...
Is this the result you wanted?
这是你想要的结果吗?
#7
0
Ed has it right. you want the timeZone on the DateFormat object after the time has been parsed.
艾德是对的。你需要在解析时间之后在DateFormat对象上使用timeZone。
String rawDate = "Friday, September 26, 2008 8:30 PM Eastern Daylight Time";
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
Date scheduledDate = dbFormatter.parse(rawDate);
System.out.println(rawDate);
System.out.println(scheduledDate);
System.out.println(dbFormatter.getTimeZone().getDisplayName());
produces
Friday, September 26, 2008 8:30 PM Eastern Daylight Time
Fri Sep 26 20:30:00 CDT 2008
Eastern Standard Time
#1
2
I found that the following:
我发现了以下内容:
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
dbFormatter.setTimeZone(TimeZone.getTimeZone("America/Chicago"));
Date scheduledDate = dbFormatter.parse("Friday, September 26, 2008 8:30 PM Eastern Daylight Time");
System.out.println(scheduledDate);
System.out.println(dbFormatter.format(scheduledDate));
TimeZone tz = dbFormatter.getTimeZone();
System.out.println(tz.getDisplayName());
dbFormatter.setTimeZone(TimeZone.getTimeZone("America/Chicago"));
System.out.println(dbFormatter.format(scheduledDate));
Produces the following:
产生以下内容:
Fri Sep 26 20:30:00 CDT 2008
Friday, September 26, 2008 08:30 PM Eastern Standard Time
Eastern Standard Time
Friday, September 26, 2008 08:30 PM Central Daylight Time
I actually found this to be somewhat surprising. But, I guess that shows that the answer to your question is to simply call getTimeZone on the formatter after you've parsed.
我实际上发现这有点令人惊讶。但是,我想这表明您的问题的答案是在解析后简单地在格式化程序上调用getTimeZone。
Edit: The above was run with Sun's JDK 1.6.
编辑:上面是使用Sun的JDK 1.6运行的。
#2
1
@Ed Thomas:
I've tried something very similar to your example and I get very different results:
我尝试过与你的例子非常相似的东西,结果非常不同:
String testString = "Friday, September 26, 2008 8:30 PM Pacific Standard Time";
DateFormat df = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
System.out.println("The default TimeZone is: " + TimeZone.getDefault().getDisplayName());
System.out.println("DateFormat timezone before parse: " + df.getTimeZone().getDisplayName());
Date date = df.parse(testString);
System.out.println("Parsed [" + testString + "] to Date: " + date);
System.out.println("DateFormat timezone after parse: " + df.getTimeZone().getDisplayName());
Output:
The default TimeZone is: Eastern Standard Time
默认TimeZone为:东部标准时间
DateFormat timezone before parse: Eastern Standard Time
解析前的DateFormat时区:东部标准时间
Parsed [Friday, September 26, 2008 8:30 PM Pacific Standard Time] to Date: Sat Sep 27 00:30:00 EDT 2008
解析[太平洋标准时间2008年9月26日星期五晚上8点30分]日期:2008年9月27日星期六00:30:00
DateFormat timezone after parse: Eastern Standard Time
解析后的DateFormat时区:东部标准时间
Seems like DateFormat.getTimeZone()
returns the same TimeZone before and after the parse()
... even if I throw in an explicit setTimeZone()
before calling parse()
.
看起来像DateFormat.getTimeZone()在parse()之前和之后返回相同的TimeZone ...即使我在调用parse()之前抛出一个显式的setTimeZone()。
Looking at the source for DateFormat and SimpleDateFormat, seems like getTimeZone()
just returns the TimeZone of the underlying Calendar... which will default to the Calendar of the default Locale/TimeZone unless you specify a certain one to use.
查看DateFormat和SimpleDateFormat的源代码,似乎getTimeZone()只返回基础Calendar的TimeZone ...除非您指定要使用的某个日历,否则将默认为默认Locale / TimeZone的Calendar。
#3
1
I recommend checking out the Joda Time date and time API. I have recently been converted to a believer in it as it tends to be highly superior to the built-in support for dates and times in Java. In particular, you should check out the DateTimeZone class. Hope this helps.
我建议查看Joda Time日期和时间API。我最近已经转变为信徒,因为它往往高度优于Java中日期和时间的内置支持。特别是,您应该查看DateTimeZone类。希望这可以帮助。
#4
1
tl;dr
ZonedDateTime.parse(
"Friday, September 26, 2008 8:30 PM Eastern Daylight Time" ,
DateTimeFormatter.ofPattern( "EEEE, MMMM d, uuuu h:m a zzzz" )
).getZone()
java.time
The modern way is with the java.time classes. The Question and other Answers use the troublesome old legacy date-time classes or the the Joda-Time project, both of which are now supplanted by the java.time classes.
现代的方法是使用java.time类。问题和其他答案使用麻烦的旧遗留日期时间类或Joda-Time项目,这两个现在都被java.time类取代。
Define a DateTimeFormatter
object with a formatting pattern to match your data.
使用格式设置模式定义DateTimeFormatter对象以匹配您的数据。
DateTimeFormatter f = DateTimeFormatter.ofPattern( "EEEE, MMMM d, uuuu h:m a zzzz" );
Assign a Locale
to specify the human language of the name-of-day and name of month, as well as the cultural norms for other formatting issues.
指定区域设置以指定日期名称和月份名称的人类语言,以及其他格式问题的文化规范。
f = f.withLocale( Locale.US );
Lastly, do the parsing to get a ZonedDateTime
object.
最后,进行解析以获取ZonedDateTime对象。
String input = "Friday, September 26, 2008 8:30 PM Eastern Daylight Time" ;
ZonedDateTime zdt = ZonedDateTime.parse( input , f );
zdt.toString(): 2008-09-26T20:30-04:00[America/New_York]
You can ask for the time zone from the ZonedDateTime
, represented as a ZoneId
object. You can then interrogate the ZoneId
if you need more info about the time zone.
您可以从ZonedDateTime请求时区,表示为ZoneId对象。如果您需要有关时区的更多信息,则可以询问ZoneId。
ZoneId z = zdt.getZone();
See for yourself in IdeOne.com.
在IdeOne.com中亲眼看看。
ISO 8601
Avoid exchanging date-time data in this kind of terrible format. Do not assume English, do not accessorize your output with things like the name-of-day, and never use pseudo-time-zones such as Eastern Daylight Time
.
避免以这种糟糕的格式交换日期时间数据。不要假设英语,不要使用诸如日常名称之类的东西来装饰您的输出,也不要使用诸如Eastern Daylight Time之类的伪时区。
For time zones: Specify a proper time zone name in the format of continent/region
, such as America/Montreal
, Africa/Casablanca
, or Pacific/Auckland
. Never use the 3-4 letter abbreviation such as EST
or IST
as they are not true time zones, not standardized, and not even unique(!).
对于时区:以洲/地区的格式指定适当的时区名称,例如America / Montreal,Africa / Casablanca或Pacific / Auckland。切勿使用3-4字母缩写,例如EST或IST,因为它们不是真正的时区,不是标准化的,甚至不是唯一的(!)。
For serializing date-time values to text, use only the ISO 8601 formats. The java.time classes use these formats by default when parsing/generating strings to represent their value.
要将日期时间值序列化为文本,请仅使用ISO 8601格式。在解析/生成字符串以表示其值时,java.time类默认使用这些格式。
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
java.time框架内置于Java 8及更高版本中。这些类取代了麻烦的旧遗留日期时间类,如java.util.Date,Calendar和SimpleDateFormat。
The Joda-Time project, now in maintenance mode, advises migration to java.time.
现在处于维护模式的Joda-Time项目建议迁移到java.time。
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
要了解更多信息,请参阅Oracle教程。并搜索Stack Overflow以获取许多示例和解释。规范是JSR 310。
Where to obtain the java.time classes?
从哪里获取java.time类?
-
Java SE 8 and SE 9 and later
- Built-in.
- Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
带有捆绑实现的标准Java API的一部分。
Java 9增加了一些小功能和修复。
-
Java SE 6 and SE 7
- Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
许多java.time功能都被反向移植到ThreeTen-Backport中的Java 6和7。
-
Android
- The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.
- See How to use….
ThreeTenABP项目特别适用于Android的ThreeTen-Backport(如上所述)。
请参阅如何使用....
Java SE 8和SE 9及更高版本内置。带有捆绑实现的标准Java API的一部分。 Java 9增加了一些小功能和修复。
Java SE 6和SE 7大部分java.time功能都被反向移植到ThreeTen-Backport中的Java 6和7。
Android ThreeTenABP项目专门针对Android调整ThreeTen-Backport(如上所述)。请参阅如何使用....
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
ThreeTen-Extra项目使用其他类扩展了java.time。该项目是未来可能添加到java.time的试验场。您可以在这里找到一些有用的课程,如Interval,YearWeek,YearQuarter等。
#5
0
Well as a partial solution you could use a RegEx match to get the timezone since you will always have the same text before it. AM or PM.
作为部分解决方案,您可以使用RegEx匹配来获取时区,因为您之前始终会有相同的文本。上午或下午。
I don't know enough about Java timezones to get you the last part of it.
我不太了解Java时区来获取它的最后一部分。
#6
0
The main difference between Date and Calendar is, that Date is just a value object with no methods to modify it. So it is designed for storing a date/time information somewhere. If you use a Calendar object, you could modify it after it is set to a persistent entity that performs some business logic with the date/time information. This is very dangerous, because the entity has no way to recognize this change. The Calendar class is designed for operations on date/time, like adding days or something like that.
Date和Calendar之间的主要区别在于,Date只是一个没有修改方法的值对象。所以它被设计用于在某处存储日期/时间信息。如果使用Calendar对象,则可以在将其设置为使用日期/时间信息执行某些业务逻辑的持久实体后对其进行修改。这非常危险,因为实体无法识别这种变化。 Calendar类专为日期/时间的操作而设计,例如添加天或类似的东西。
Playing around with your example I get the following:
玩弄你的例子,我得到以下内容:
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class TimeZoneExtracter {
public static final void main(String[] args) throws ParseException {
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
System.out.println(dbFormatter.getTimeZone());
dbFormatter.parse("Fr, September 26, 2008 8:30 PM Eastern Daylight Time");
System.out.println(dbFormatter.getTimeZone());
}
}
Output:
sun.util.calendar.ZoneInfo[id="Europe/Berlin"... sun.util.calendar.ZoneInfo[id="Africa/Addis_Ababa"...
Is this the result you wanted?
这是你想要的结果吗?
#7
0
Ed has it right. you want the timeZone on the DateFormat object after the time has been parsed.
艾德是对的。你需要在解析时间之后在DateFormat对象上使用timeZone。
String rawDate = "Friday, September 26, 2008 8:30 PM Eastern Daylight Time";
DateFormat dbFormatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa zzzz");
Date scheduledDate = dbFormatter.parse(rawDate);
System.out.println(rawDate);
System.out.println(scheduledDate);
System.out.println(dbFormatter.getTimeZone().getDisplayName());
produces
Friday, September 26, 2008 8:30 PM Eastern Daylight Time
Fri Sep 26 20:30:00 CDT 2008
Eastern Standard Time