Adding unknown variables to time.mktime()

Roman Suzi rnd at onego.ru
Tue Jun 26 10:01:24 EDT 2001


On Tue, 26 Jun 2001, Steve Holden wrote:

> "Gustaf Liljegren" <gustafl at algonet.se> wrote ...
> > "Roman Suzi" <rnd at onego.ru> wrote:
> >
> > > >to be able to give only the 6 first values, since I've never heard of
> > > >Julian days, and week day is not significant in this case.
> >
> > > try with all 9 integers.
> > > RTFM time module docs.
> >
> > Read before you post. I always check the library reference, but it doesn't
> > give any hints on what I asked for. If mktime() can't do it, maybe there's
> > anyother way that you could suggest?
> >
> > Gustaf
> >
> Gustaf:
> 
> Use zeroes?
> 
> >>> import time
> >>> time.asctime( (1999, 2, 12, 1, 34, 12, 0, 0, -1) )
> 'Mon Feb 12 01:34:12 1999'
> 
> Aargh. This is REALLY dumb:

No problem:

>>> from time import *
>>> asctime(localtime(mktime((2001,6,26,18,0,23,-1,-1,-1))))
'Tue Jun 26 18:00:23 2001'

Just keep your time always in GMT (aka UTC) and represent to user in
localtime when needed. 
 
> >>> time.asctime( (1999, 2, 12, 1, 34, 12, 1, 1, -1) )
> 'Tue Feb 12 01:34:12 1999'
> 
> Have you looked at mxDateTime?

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 





More information about the Python-list mailing list