FW: Questions

Fan_Zhenqiang at emc.com Fan_Zhenqiang at emc.com
Wed Apr 4 22:00:36 UTC 2007


 
Hi Michael,
Thank you for your reply. 
Sorry that I used ambiguous example. What I really asked is:

Is there a function that takes a time zone, say America/Los_Angles, and
a date value such as "2007-11-04 01:30", and tells whether the given
date/time value is a DST in that time zone? If no, how easy is it to
write such a function?

Thanks again.

Zhenqiang Fan

-----Original Message-----
From: Michel Bourget [mailto:michel at sgi.com] 
Sent: Wednesday, April 04, 2007 12:39 PM
To: tz at elsie.nci.nih.gov
Cc: Fan, Zhenqiang; tz at lecserver.nci.nih.gov
Subject: Re: FW: Questions

On Wed, 2007-04-04 at 10:41 -0700, Paul Eggert wrote:
> Fan_Zhenqiang at emc.com writes:
> 
> > What if a time zone is specified together with the date/time value?
For
> > instance, is there any function that call whether "2007-11-04 01:30
PST"
> > is DST?
> 
> Sorry, no; in general that's not possible, as in some locations the
> same abbreviation is used for both standard and daylight time.  One
> could do a reasonable job in most cases, as in the other problems you
> mentioned; it shouldn't be that hard, but the functions aren't there
> now.

Bottom line, you need to know the *context*( the geographic location )
of the date, hence the Country/City TZ value information, and not the
abbreviation ( DST, PST, WAT, ... ). Then, as explained earlier, use
localtime() returned 'struct tm'->tm_isdst value. Unfortunately, the %Z
format still gives the abbreviation, not the time zone itself. 

Briefly. To compute isdst, you need date and TZ( not its abbreviation ).

-- 
-----------------------------
 Me:     If I can , I want.
 Not me: If I want, I can.
 A boss: If I want, you can.
-----------------------------





More information about the tz mailing list