[Zope] Solution: DateTime: Get DateTime-Objekt from german dateformat %d.%m.%Y

Patrick Ulmer ulmer at truckport.de
Thu Mar 3 08:36:49 EST 2005


Hi,

> i have a litte problem to insert my german dateformat into my 
> SQL-Database, because I must convert it to ISO-Format. I try
>
> datum=_.DateTime (wiedervorlage).ISO())
>
> but day and month ar interchanged.
>
> How can I convert my datestring '1.3.2005' to '2005-03-01'?


One solution is to put this in an external method:

from time import strftime, strptime
print strftime("%Y-%m-%d", strptime ("1.3.2005", "%d.%m.%Y"))

Thanks,
Patrick



More information about the Zope mailing list