file date/time on windows

MRAB google at mrabarnett.plus.com
Wed Jan 28 10:56:36 EST 2009


m.banaouas wrote:
> hi,
> 
> 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.
> 
> Example:
> 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 mailing list