UTC equivalent of time.mktime() ?
Donn Cave
donn at u.washington.edu
Wed Apr 17 13:51:58 EDT 2002
More information about the Python-list mailing list
Wed Apr 17 13:51:58 EDT 2002
- Previous message (by thread): UTC equivalent of time.mktime() ?
- Next message (by thread): UTC equivalent of time.mktime() ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Quoth Graham Ashton <gashton at cmedltd.com>: | On Wed, 2002-04-17 at 17:11, Mark McEahern wrote: |> Why not just use the mxDateTime library and just do something like this: |> |> mx.DateTime.utc().ticks() | | I appreciate that I could (and thanks for the suggestion), but does this | really mean that via the standard library there is no easy way to | convert "1 Jan 1970" to 0 (i.e. string to seconds since epoch)? I have not been following, so pardon me if this has already been suggested, but on a platform where you have 2.0 or later and strptime, this might do that: lt = time.mktime(time.strptime(sys.argv[1], '%d %b %Y')) utoffset = time.mktime(time.gmtime(lt)) - lt print lt - utoffset Donn Cave, donn at u.washington.edu
- Previous message (by thread): UTC equivalent of time.mktime() ?
- Next message (by thread): UTC equivalent of time.mktime() ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list