joetsuihk
joetsuihk

Reputation: 534

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?

Upvotes: 6

Views: 1326

Answers (1)

meder omuraliev
meder omuraliev

Reputation: 186562

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)

Upvotes: 11

Related Questions