Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54239
| From | random832@fastmail.us |
|---|---|
| Subject | Re: Is %z broken for return values of time.gmtime()? |
| Date | 2013-09-16 13:56 -0400 |
| References | <3C2755B3-2478-45E1-88F5-9FD961F2B1BD@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.34.1379354165.18130.python-list@python.org> (permalink) |
On Mon, Sep 16, 2013, at 9:15, Michael Schwarz wrote: > According to the documentation of time.gmtime(), it returns a struct_time > in UTC, but %z is replaced by +0100, which is the UTC offset of my OS’s > time zone without DST, but DST is currently in effect here (but was not > at the timestamp passed to gmtime()). The struct_time type does not include information about what timezone it is in. You can use datetime.datetime (e.g. datetime.datetime.fromtimestamp(40 * 365 * 86400,datetime.timezone.utc) - the datetime.datetime class has a strftime method. You should be aware that %F and %T are not portable and won't work on windows for example.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Is %z broken for return values of time.gmtime()? random832@fastmail.us - 2013-09-16 13:56 -0400
csiph-web