Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67579 > unrolled thread

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

Started byBen Finney <ben+python@benfinney.id.au>
First post2014-03-04 08:06 +1100
Last post2014-03-04 08:06 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: modification time in Python - Django: datetime != datetime :-( Ben Finney <ben+python@benfinney.id.au> - 2014-03-04 08:06 +1100

#67579 — Re: modification time in Python - Django: datetime != datetime :-(

FromBen Finney <ben+python@benfinney.id.au>
Date2014-03-04 08:06 +1100
SubjectRe: modification time in Python - Django: datetime != datetime :-(
Message-ID<mailman.7657.1393880794.18130.python-list@python.org>
Jaap van Wingerde <mailinglists@vanwingerde.nl> writes:

> >>> time.strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime('/var/django/test2/art/templates/art_index.html')))  
> '2014-03-02T19:03:55Z'
> >>> quit()  
> jaap@liakoster:~$ ls --full-time /var/django/test2/art/templates/art_index.html
> -rwxrwx--- 1 lia www-data 2456 2014-03-02 19:16:55.568139590 +0000 /var/django/test2/art/templates/art_index.html
> jaap@liakoster:~$ 
> ...
>
> ls gives the right modification time. What is wrong?

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?

What value does the Python datetime value show in the local timezone?
How does that compare to the time shown by ‘ls’?

-- 
 \              “When cryptography is outlawed, bayl bhgynjf jvyy unir |
  `\                                              cevinpl.” —Anonymous |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web