3 Mar
2005
3 Mar
'05
1:47 p.m.
--On Donnerstag, 3. März 2005 14:36 Uhr +0100 Patrick Ulmer <ulmer@truckport.de> wrote:
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"))
Why do you make it so complicated? And why don't you modify your SQL query so that it returns your date in a format e.g. YYYYDDMM can can be parsed by DateTime out-of-the-box? This would be the most straight forward way to go. -aj