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

Chris Angelico rosuav at gmail.com
Mon Mar 3 09:08:52 EST 2014


On Tue, Mar 4, 2014 at 12:35 AM, Jaap van Wingerde
<mailinglists at vanwingerde.nl> wrote:
>>>> 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 at 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

See if ls is actually giving you ctime rather than mtime - compare the
results if you ask for os.path.getctime.

ChrisA



More information about the Python-list mailing list