[Tutor] deleting files that are older than x days old

Kent Johnson kent37 at tds.net
Thu Jul 14 00:10:28 CEST 2005


Mike Hansen wrote:
> The docs for fromtimestamp weren't clear to me. i.e. not spelling it out that it 
> converts from seconds from the epoch(which must be the POSIX timestamp it's 
> referring to).

You just have to dig a little in the docs:

datetime.datetime.fromtimestamp(timestamp[, tz])
    Return the local date and time corresponding to the POSIX timestamp, such as is returned by time.time().

time.time()
    Return the time as a floating point number expressed in seconds since the epoch, in UTC.

os.path.getmtime(path)
    Return the time of last modification of path. The return value is a number giving the number of seconds since the epoch (see the time module).

Kent


More information about the Tutor mailing list