美文网首页
倒推日期脚本

倒推日期脚本

作者: adonisjph | 来源:发表于2016-07-14 20:25 被阅读35次

    需要输入一个数字,然后获取当天日期,并以此数字倒推相应的天数,获得那时的日期,记录下

    import datetime
    
    def get_date(days):
        a=str(datetime.date.today()-datetime.timedelta(days=int(days))).replace('-','.')
        return a
    
    print get_date(30)
    
    
    
    

    相关文章

      网友评论

          本文标题:倒推日期脚本

          本文链接:https://www.haomeiwen.com/subject/jcoljttx.html