So this should be simple, but I can't figure it out. No matter what I do, my local timezone displays as GMT-5:00.
I need it to display as EDT/EST because I want to set a milli date and then query whether its in daylight savings time or not
but setting the timezone object with tz.setTimeZone("America/New_York") displays GMT-5:00
when I display a date in september. I've tried setting the user.timezone property in sys.
I've tried setting in SimpleDateFormat as well. My Code looks like this:
My output returns:
12/14/2012 05:47 GMT
Date = Fri Dec 14 05:47:34 GMT 2012
Calendar = java.util.GregorianCalendar[time=1355464054992,areFieldsSet=true,areAllFieldsSet=true,lenient=true,
I'm sure I don't understand something but I'm stuck.
btw: my actual timezone is EST which is equivalent to GMT-05:00, but I don't understand why it displays as a
custom timezone rather than just EST. And why the calendar object and Date object both display GMT.
Have a look at the TimeZone documentation. It doesn’t say anything about summer time and winter time or daylight saving time and night-time extending time. The time zone remains constant whether it is summer or winter. I know there is a database somewhere in the JRE of summer and winter times worldwide, because I keep getting messages saying it has to be updated. Remember Moscow, which ought to be several feet deep in snow now, and Cape Town, where it is almost midsummer, are in the same time zone, so summer time is not linked directly to time zones.
I don’t know much more about time zone objects, but you appear to have a couple of fields called DST_SOMETHING. You could try reading the TimeZone#toString documentation, and the documentation for this class.
I also looked at the Calendar class and the Date class and this is the only thing I found.