os.stat - time format conversion + md5
Martin v. Löwis
martin at v.loewis.de
Tue Dec 17 10:02:24 EST 2002
pennedinil at excite.com (DP) writes:
> I'm sure this has been asked before -- how do I convert the output of
> os.stat(some_filename) to "plain" understandable time format, i.e.
> DD/MM/YYYY HH:MM:SS.
First, you should access the right field; there is st_mtime, st_atime,
st_ctime - RTFM.
Then, you should understand that these fields are seconds since the
epoch (i.e. since 1970); to convert this to a broken-down set of
values, use time.gmtime (RTFM).
Finally, if you want a string, you can use time.asctime; if the string
does not meet your needs, use time.strftime (RTFM).
Regards,
Martin
More information about the Python-list
mailing list