how to store a date in a file with mxDateTime

M.-A. Lemburg mal at lemburg.com
Tue May 15 07:37:21 EDT 2001


Scott Hathaway wrote:
> 
> Here is what I am trying to do:
> 
> 1.  store a date in a file.
> 2.  compare the dates to see if today + 15 days is greater than the date
> from the file.
> 
> (I am implementing a timeout in a program if not registered).
> 
> I am using the mx.DateTime library, but I cannot seem to get the following
> comparision to work because the dateFromFile is a string.
> 
> todayPlus15Days = DateTime.today() + 15
> if (todayPlus15Days > fileFromDate):

You have to convert the string fileFromDate to a DateTime instance
first... e.g. DateTimeFrom(fileFromDate) should do the trick
in most cases.
 
> I have tried the RelativeDateFrom(fileFromDate) method and
> DateTimeFrom(fileFromDate) method without success.
> 
> Can anyone help?

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/




More information about the Python-list mailing list