[Zope] turn string into date

Troy Farrell troy@entheossoft.com
Thu, 24 Jan 2002 19:18:00 -0600


Steffen,
   You didn't mention what platform you're working on.  If you're on 
MS-Windows anything, strftime should not work.  Limitations to windows 
libraries keep python 2.1.* from offering strftime, which DateTime.py 
imports by default from time.  If this is not the case with the python 
included in zope for win, please correct me.

Troy

Steffen Hausmann wrote:

> Andreas Jung wrote:
> 
>> DateTime('2002/01/18 21:34:18.4746 GMT+1' ).strftime('%m') should 
>> work. In your example you just assign a *representation* of the date
>> to a string instead of passing the representation to the constructor
>> of the DateTime class.
> 
> 
> 
> 'DateTime('2002/01/18 21:34:18.4746 GMT+1' ).strftime('%m')' works fine, 
> but it was only an example that I set 'lastDate' manualy in the script ( 
> I thought it wouldn't make a difference, but it somehow does ).
> 
> In reality 'lastDate' is passed to the script by a dtml-method which 
> gets the date from an object's bobobase_modification_time.
> 
> I tried 'DateTime( lastDate ).strftime( '%m' )' but I got a type error:
> 
> Error Type: Invalid Date-Time String
> Error Value:
> 
> If I change the script into 'return lastDate' it returns something like 
> '2002/01/18 21:34:18.4746 GMT+1'.
> 
> Thanks anyhow
> Steffen