【问题标题】:Is there something like date_diff in python to get tomorrow date ?python中是否有类似 date_diff 的东西来获取明天的日期?
【发布时间】:2012-12-30 23:46:55
【问题描述】:

这是我的代码

while x <= datetime.date.today():
   print something 

我怎样才能得到datetime.date.tomorrow()

【问题讨论】:

    标签: python date format


    【解决方案1】:

    使用datetime.timedelta():

    tomorrow = datetime.date.today() + datetime.timedelta(days=1)
    

    date()timedelta() 相加时,仅使用.days 属性。

    【讨论】:

      猜你喜欢
      • 2012-06-11
      • 1970-01-01
      • 1970-01-01
      • 2012-03-25
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 2021-09-29
      • 2016-10-17
      相关资源
      最近更新 更多