【问题标题】:How to get Timestamp of 11PM or Any Time, Python 3.6如何获取 11PM 或任何时间的时间戳,Python 3.6
【发布时间】:2020-06-16 01:24:51
【问题描述】:

time.time() 将给出当前时间戳,我只想获取 11PM 或任何时间的时间戳。

我需要这个来比较 time.time() == 11PM 的时间,然后执行一些任务。

【问题讨论】:

  • 您需要提供更多详细信息,time 是什么?可以举个例子数据吗?
  • 当您用 Google 搜索如何在 Python 中操作时间输出时,您发现了什么?
  • 我认为这可以满足您的需求? stackoverflow.com/questions/1831410/python-time-comparison
  • @DanWarren 谢谢,我明白了

标签: python python-3.x pandas datetime


【解决方案1】:

下面的脚本工作:

import datetime, time

now = datetime.datetime.now()
time_to_change = now.replace(hour=23, minute=50, second=0, microsecond=0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-21
    • 2019-06-05
    • 2021-07-20
    • 2018-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多