python开发_python日期操作
发布时间:2020-12-17 00:18:48 所属栏目:Python 来源:网络整理
导读:在python中对日期进行操作的库有: time 对日期格式化信息,可以参考官方API: 下面是我做的demo: now = (now.strftime( (now.strftime( time_str = str_convert_2_time = datetime.datetime.strptime(time_str, time_strA = time_strB = day = datetime.da
在python中对日期进行操作的库有: time
对日期格式化信息,可以参考官方API:
下面是我做的demo:
now = (now.strftime( (now.strftime(
time_str =
str_convert_2_time = datetime.datetime.strptime(time_str,
time_strA =
time_strB =
day = datetime.datetime.strptime(time_strA, day2 = datetime.datetime.strptime(time_strB, sub_day = day2 - (
n_days = 4
now = my_date = datetime.timedelta(days= n_day = now + ( (n_day.strftime())
运行效果: Python 3.3.2 (v3.3.2:d047928ae3f6,May 16 2013,00:03:43) [MSC v.1600 32, >>> ================================ RESTART ================================
>>>
2013-07-29 01:48:16
2013-07-29
2013-07-29 01:05:00
2013-07-29 01:05:00和2013-08-29 01:052013-08-02 01:48:16
>>>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |