Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'method.': 0.07; 'dst': 0.09; 'received:internal': 0.09; 'windows': 0.15; '365': 0.16; 'dst,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'portable': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'strftime': 0.16; 'subject:broken': 0.16; 'subject:values': 0.16; 'timestamp': 0.16; 'utc': 0.16; 'utc,': 0.16; 'wrote:': 0.18; '(but': 0.19; 'example.': 0.24; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; '+0100,': 0.31; 'sep': 0.31; 'class': 0.32; '(e.g.': 0.33; 'received:66': 0.35; 'but': 0.35; 'in.': 0.36; 'should': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'information': 0.63; 'here': 0.66; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:subject:date:in-reply-to:references; s=mesmtp; bh= biV462xwnc53zPjzT35KyB2qJYg=; b=QknqDhPUcXZKo+H214oVfzJb5wO6PuLa VpsId9KRIgQuSZKWn0AUyC1gp80m92Z6Vb+oouvn8U0m2ozyWUtZ4F1aDmCgApQy BVrE8mDBdGHk0YmFxseCSLZ9YP5HimlAqTkTcFD6U76ad2yFMxVxqPaKTuy0B5OM i2X3AcZJ7IE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=smtpout; bh=biV462xwnc53zPjzT35KyB2qJYg=; b=KmcOq qFt1Lz6QQsiibQqy2uTpt/PACDxOANw7LAsvnfzH4HGB1tdI7mKGt+qeRJGM6W+i p43cu/BTkVRXzT+T/HODPSL6hsYtJ7bknZwk9BTMf9yul5NyfbWahEbge9Tnq4mn cakUUS2ynav2Ag9cSxTN1ukI1KAbdjESo687VI= X-Sasl-Enc: 0mJxhCqCufZmjlT6UC71I4BwLUsEP6ggoJvkv5ytad/L 1379354161 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-d310b333 Subject: Re: Is %z broken for return values of time.gmtime()? Date: Mon, 16 Sep 2013 13:56:01 -0400 In-Reply-To: <3C2755B3-2478-45E1-88F5-9FD961F2B1BD@gmail.com> References: <3C2755B3-2478-45E1-88F5-9FD961F2B1BD@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379354165 news.xs4all.nl 15955 [2001:888:2000:d::a6]:36821 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54239 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=E2= =80=99s > 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.