date and time comparison how to

Adam Tauno Williams awilliam at whitemice.org
Fri Nov 2 12:22:50 CET 2012


On Mon, 2012-10-29 at 16:13 -0700, noydb wrote:
> All,
> I need help with a date and time comparison.
> Say a user enters a date-n-time and a file on disk.  I want to compare
> the date and time of the file to the entered date-n-time; if the file
> is newer than the entered date-n-time, add the file to a list to
> process.
> How best to do?  I have looked at the datetime module, tried a few
> things, no luck.
> Is os.stat a part of it?  Tried, not sure of the output, the
> st_mtime/st_ctime doesnt jive with the file's correct date and
> time.  ??
> Any help would be appreciated!

Date and time is much more complicated then people guess at first.

<http://taaviburns.ca/what_you_need_to_know_about_datetimes/datetime_transforms.html>
<http://www.whitemiceconsulting.com/2012/10/setting-course-for-utc.html>

What do you mean by "st_mtime/st_ctime doesnt jive with the file's
correct date"?  Is it off my some offset, or does it completely not
match?



More information about the Python-list mailing list