python 日期/时间 操作汇总


一、日期查计算

021-10-05T15:38:37.000+0800 格式的2个日期差计算

        b = datetime.datetime.strptime(bug_detail.fields.resolutiondate, "%Y-%m-%dT%H:%M:%S.%f+0800")
        a = datetime.datetime.strptime(bug_detail.fields.created, "%Y-%m-%dT%H:%M:%S.%f+0800")
        return round((b-a).total_seconds() / 3600,1)