Date Comparison and Manipulation Functions?

W. eWatson notvalid2 at
Sat Aug 30 19:33:46 CEST 2008

W. eWatson wrote:
> John Machin wrote:
>> On Aug 30, 10:41 am, "W. eWatson" <notval... at> wrote:
>>> What I'm trying to do is adjust date-time stamped file names for date 
>>> and
>>> time errors. The software program collects through a period that roughly
>>> coincides with night hours every day and according to the OS clock. It
>>> sometimes happens that a user sets the clock to the wrong day or hour,
>>> possibly both. Possibly even the month or year. I'm trying to allow a 
>>> user
>>> the opportunity to repair the problem. (Date-time stamp part of the 
>>> name is
>>> yyyymmdd_hhmmss.) Correcting the date needs to be done easily and
>>> accurately. For example, if on August 25, he mistakenly sets the date to
>>> July 25, and discovers this problem on the real Oct. 5, he should be 
>>> able to
>>> shift all dates from July 25 through Sept. 5 to Aug. 25 through early 
>>> Oct.,
>>> allowing for day oddities in a month during the period. (I hope I got 
>>> those
>>> dates right; otherwise, I think you get the idea. In other words, he 
>>> needs
>>> to shift about 40 days of data to the correct dates.)
>> ... all of which is absolutely nothing to do with your surprise at the
>> result of
> Really? It opened new insights for me. The example above is not the only 
> correction I need to deal with. Further, the author is likely to soon 
> clarify some of the date rules in the tutorial that were not obvious or 
> mentioned there.
>> So for some period from recorded date X to recorded date Y, the
>> recorded dates of out of kilter by D days. X = Jul 25 2008, Y Sep 5
>> 2008, and D is 31 (days from Jul 25 to Aug 25). All you have to do is
>> (pseudocode):
>> if X <= recorded_date <= Y:
>>     new_recorded_date  =
>> HTH,
>> John
Strange how my post got hooked into this side spur. I'll re-post.

                                    W. Watson
              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

More information about the Python-list mailing list