Python datetime-在使用strptime来获取日,月,年之后设置固定的小时和分钟 [英] Python datetime - setting fixed hour and minute after using strptime to get day,month,year

查看:377
本文介绍了Python datetime-在使用strptime来获取日,月,年之后设置固定的小时和分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功使用以下方法将26 Sep 2012格式的内容转换为26-09-2012:

I've successfully converted something of 26 Sep 2012 format to 26-09-2012 using:

datetime.strptime(request.POST['sample_date'],'%d %b %Y')

但是,我不知道如何将上述时间设置为11:59.有人知道该怎么做吗?

请注意,这可以是将来的日期,也可以是任意随机的日期,而不仅仅是当前日期.

Note, this can be a future date or any random one, not just the current date.

推荐答案

使用 查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆