Weiguo's Station

  • 博客首页

  • 文章归档

  • 分类专栏

  • 各种标签

  • 站点搜索

python常用实例

发表于 2019-03-13 更新于 2021-03-22 分类于 小工具

求两个时间之间的差

1
2
3
4
5
6
from datetime import datetime as dt
insert = dt.strptime('2018-03-22 10:00:00', "%Y-%m-%d %H:%M:%S")
current = dt.strptime(str(dt.now().strftime('%Y-%m-%d')), '%Y-%m-%d')
print (current-insert).days # 天
print (current-insert).seconds # 秒
print (current-insert).microseconds # 毫秒
# 常用实例
Spark基础
Vim Tutorial
  • 文章目录
  • 站点概览
WeiguoZHAO

WeiguoZHAO

Welcome to my blog~
87 日志
13 分类
49 标签
GitHub E-Mail
大牛们
  • colah's blog
  • 王喆的Github
  • 刘建平的Github
  • 美团技术团队
  1. 求两个时间之间的差
© 2021 WeiguoZHAO
0%