file date/time on windows
banaouas.medialog at wanadoo.fr
Thu Jan 29 00:02:50 CET 2009
someone gave me the solution:
simply call time.localtime(...) instead of time.gmtime(...)
The explorer file time is what I need because it's the only file date visible
for most of users. So localtime is perfect for me.
We are talking about the same file stored in a shared lan-computer-folder.
I gess that if computers of those users are in different timezones, they could
see different file date ?
MRAB a écrit :
> m.banaouas wrote:
>> I noticed recently that the value of file date/time I get with python:
>> time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime))
>> is forwarding by one hour the real file date/time.
>> file A.txt: 2009-01-18 16:13
>> returned valeur: 2009-01-28 15:13
>> Is there a simple way to get it work correctely (other than adding
>> always 1
>> hour ...) ?
> time.gmtime(), as the name suggests, returns GMT (UTC).
> From your email address I presume you're in France, which is GMT+1.
> Windows Explorer shows the file time in local time, which for you is
> currently GMT+1, but when the clocks go forward (DST) it'll be GMT+2.
More information about the Python-list