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


Groups > comp.lang.python > #67579

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

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: modification time in Python - Django: datetime != datetime :-(
Date 2014-03-04 08:06 +1100
References <20140303133541.66fccbbb@lia.custard.shrl.nl>
Newsgroups comp.lang.python
Message-ID <mailman.7657.1393880794.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web