What's the most elegant way to get the end of the day (datetime)?

前端 未结 6 1535
无人及你
无人及你 2021-02-14 10:16

I\'m currently writing some reporting code that allows users to optionally specify a date range. The way it works (simplified), is:

  • A user (optionally) specifies a
6条回答
  •  你的背包
    2021-02-14 11:19

        today = datetime.date.today()
        begintime = today.strftime("%Y-%m-%d 00:00:00")
        endtime = today.strftime("%Y-%m-%d 23:59:59")
    

提交回复
热议问题