date-time comparison, aware vs naive

John Gordon gordon at panix.com
Mon Dec 10 21:22:34 CET 2012


In <21eb3e6f-9a82-47aa-93ff-8f4083d18b66 at googlegroups.com> noydb <jenn.duerr at gmail.com> writes:

> I want to compare a user entered date-and-time against the date-and-time of
> a pdf file.  I posted on this (how to get a file's date-time) before, was
> advised to do it like:

> import datetime, os, stat
> mtime = os.lstat(filename)[stat.ST_MTIME] // the files modification time
> dt = datetime.datetime.fromtimestamp(mtime)

> I am having problems with the comparison, that line is failing.

What line?  You haven't posted any comparison line of code here.

Please post the actual code you're using, instead of telling us about it.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list