开发者

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 data开发者_运维百科store?


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜