Convert string to datetime in django?

后端 未结 2 1150
情歌与酒
情歌与酒 2021-01-29 01:43

i want to display time in 12 hour format in django templates as iam storing time data in a charecter eg(\'18:30:00\') field how to convert this string time data to date in djang

2条回答
  •  半阙折子戏
    2021-01-29 02:05

    If you absolutely must do this, use time.strptime. It would be a better idea not to store structured data in a string if you can avoid it, though.

提交回复
热议问题