Thanks very much.

BTW, is it better to use Calendar instead of Date in most condition?
Many methods in Date are marked as deprecated.

On Jul 20, 4:11 am, Brian Conrad <[email protected]> wrote:
> 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 
> fromtimetotime).  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 currenttimezone
> 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 StandardTime
> and not DST and -7.00 ifDaylightSavingTimeis 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
> standardtimein 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 withDaylightSavingTime
> > enabled?
>
> > Does this function returns a DSTtimeor not?
>
> > I call Date.getTime() in a place with DST (such as U.S.), and convert
> > it to a  localtimein China (no DST), I get a wrongtime(one hour
> > ahead of localtimein 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to