time.daylight (Daylight Saving Time)

Richard van de Stadt stadt at cs.utwente.nl
Mon Nov 5 18:32:37 EST 2001


Matthew Dixon Cowles wrote:
> 
> On Mon, 05 Nov 2001 13:59:39 +0100, Richard van de Stadt
> <stadt at cs.utwente.nl> wrote:
> 
> >Hi,
> 
> Hi!
> 
> >I'm using time.tzname[time.daylight] to display the time zone. This worked
> >fine as long a Daylight Saving Time (DST) was valid

[...]

> I think you want something more like:
> 
> >>> import time
> >>> timeTuple=time.localtime(time.time())
> >>> time.tzname[timeTuple[8]]
> 'CST'
> 
> You might want to check that daylight is nonzero first.

Got it.

Thanks.

Richard.



More information about the Python-list mailing list