How to extract hours and minutes from a datetime.datetime object?

前端 未结 4 1415
渐次进展
渐次进展 2020-12-15 02:25

I am required to extract the time of the day from the datetime.datetime object returned by the created_at attribute. But I do not understand how to do that. This is my code

4条回答
  •  旧时难觅i
    2020-12-15 03:09

    Don't know how you want to format it, but you can do:

    print("Created at %s:%s" % (t1.hour, t1.minute))
    

    for example.

提交回复
热议问题