Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

app engine: string to datetime?

i have string

date = "11/28/2009"
hour = "23"
minutes = "59"
seconds = "00"

how can i convert to datetime object and store it in datastore?

like image 209
joetsuihk Avatar asked Nov 23 '09 10:11

joetsuihk


1 Answers

I apologize if this isn't what you want, but at least for the first part of the question you could probably do it like so?

>>> import datetime
>>> datetime.datetime.strptime(date + ' ' + hour + ':' + minutes + ':' + seconds, '%m/%d/%Y %H:%M:%S')
datetime.datetime(2009, 11, 28, 23, 59)
like image 174
meder omuraliev Avatar answered Sep 29 '22 22:09

meder omuraliev