You're lucky because DST is a mess with different starting and ending times all over the world (and the countries will often change them from time to time). It is generally not used in countries near the equator like India where sunrise and sunset won't vary that much during the year to make it practical. Here's what I use to get the current time zone whether the phone is set to a zone using DST or not: Calendar c = Calendar.getInstance(); double z = (double)c.getTimeZone().getOffset(c.getTimeInMillis()) / 3600000.0;
This will return a value such as -8.00 if it is Pacific Standard Time and not DST and -7.00 if Daylight Saving Time is in effect. There are other methods such as: Calendar cal = Calendar.getInstance(); double zone = (cal.get(Calendar.ZONE_OFFSET)+cal.get(Calendar.DST_OFFSET))/3600000.0; I believe I found the first one may automatically change with DST and the second one may too. The general rule with DST is spring forward (you set the clock ahead one hour in the spring) and fall back (you set the clock back one hour to standard time in the fall). When these spring and fall change dates occur is the mess. - Brian Cheng Zhong wrote: > Hi all, > > What will Date.getTime() returns in a region with Daylight Saving Time > enabled? > > Does this function returns a DST time or not? > > I call Date.getTime() in a place with DST (such as U.S.), and convert > it to a local time in China (no DST), I get a wrong time (one hour > ahead of local time in China). How can I fixed this problem? > > Maybe I didn't tell tings clearly, but we don't use DST in China... I > don't understand DST very well. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

