[Zope] Solution: DateTime: Get DateTime-Objekt from german
dateformat %d.%m.%Y
Patrick Ulmer
ulmer at truckport.de
Thu Mar 3 10:29:33 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"))
>
> 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.
I want to insert the string an a datefield and the needed SQL-function
|STR_TO_DATE(/|str|/,/|format|/) is only available in MySQL 4.1.1 but I
use 4.0.x. To get the wished format from my select-statement is not the
problem.|
More information about the Zope
mailing list