modification time in Python - Django: datetime != datetime :-(

Jaap van Wingerde mailinglists at vanwingerde.nl
Tue Mar 4 05:33:19 EST 2014


Op 2014-03-03T12:22:48 UTC schreef donarb <donarb at nwlink.com> in het
bericht <Re: modification time in Python - Django: datetime !=
datetime :-(>, ID: <04659633-e14e-4d5b-90f2-93af04f056be at googlegroups.com> het volgende. 

> You're using the months format '%m' when you should be using minutes
> '%M'.

Arrgh: stupid error (snik).

p 2014-03-04T08:11:46 UTC schreef Chris Angelico <rosuav at gmail.com> in
het bericht <Re: modification time in Python - Django: datetime !=
datetime :-(>, ID: <CAPTjJmrz-oq-YLZ_0=jHgj9B1y4s_6bZfN52XMn6Xw10TXE2FQ at mail.gmail.com>
het volgende. 

> Heh! I didn't even notice that. When I tested it, I didn't use
> strftime at all, just looked at gmtime's output.

Op 2014-03-04T08:06:21 UTC schreef Ben Finney <ben+python at benfinney.id.au> in het bericht <Re: modification time in
Python - Django: datetime != datetime :-(>, ID: <85txbfhu0i.fsf at benfinney.id.au> het volgende.

> You're using ‘gmtime’ to display the Python datetime value, but ‘ls’
> will display the time in the local timezone. Do you have a strange
> timezone set?

I only use UTC.

Thanks!!!!

The view.py is now as follows.

...
home_lastmod = strftime('%Y-%m-%dT%H:%M:%SZ',gmtime(os.path.getmtime(os.path.dirname(os.path.realpath(__file__ ))+'/templates/art_index.html')))
...

-- 

Jaap van Wingerde
e-mail: 1234567890 at vanwingerde.nl




More information about the Python-list mailing list