views:

132

answers:

2

At start you have a string 'DDMMYYYY HHMMSS' and I want at the end to insert the string in a date field in sqlite3 database. The program is made in python. How can I do that ?

+1  A: 

Even though the ".schema" indicates that the field is a date or timestamp field... the field is actually a string. You can format the string anyway you want. If memory serves... their is no validation at all.

Richard
+1  A: 

I believe sqlite3 doesn't have a DATE type, therefore you have to do it manually in your python code. Either you store the date in exactly this form or you convert it into a timestamp or some other form.

Have a look at the datetime module and especially at the strptime function.

Georg