python时间格式输出 以及递增 日期加一天
来源:互联网 发布:微软软件开发工具 编辑:程序博客网 时间:2024/05/18 01:59
import datetime
#现在的时间now=datetime.datetime.now()#递增的时间delta=datetime.timedelta(days=1)#六天后的时间endnow=now+datetime.timedelta(days=6)#六天后的时间转换成字符串endnow=str(endnow.strftime('%Y-%m-%d'))offset=now#当日期增加到六天后的日期,循环结束while str(offset.strftime('%Y-%m-%d')) != endnow: offset += delta print(str(offset.strftime('%Y-%m-%d')))
输出结果:
C:\Python27\python.exe C:/Users/gf/Desktop/python草稿测试/python时间输出
2017-12-05
2017-12-06
2017-12-07
2017-12-08
2017-12-09
2017-12-10
Process finished with exit code 0
阅读全文
0 0
- python时间格式输出 以及递增 日期加一天
- 日期时间加一天
- 日期格式输出时间
- ORA-01861: 文字与格式字符串不匹配 以及 oracle日期怎么加一天?
- oracle实现日期加一天的时间
- SQL格式化输出日期 时间格式
- ls指定日期和时间输出格式
- Python日志格式输出与时间格式
- 用CDate类成员函数实现对用户按照年月日格式输入的日期加一天后按照年/月/日格式输出
- 日期加一天、一月
- Java 日期加一天
- Calendar日期加一天
- 日期加一天
- 时间戳、日期格式、以及相互转换
- js中字符串转换日期格式,日期转换字符串,操作日期(如:加一天)
- python 实现日期加1天或减少一天
- Python获取并输出当前日期时间
- Python获取并输出当前日期时间
- numpy库
- 关于指针传递和指针的引用传递
- 数据结构:手动编写Java栈
- Solr之高亮显示-yellowcong
- 介绍一种音频信号分类方法
- python时间格式输出 以及递增 日期加一天
- Spring 事务
- Oracle 存储过程样例
- FMDB保存数组和字典
- Cassandra_架构
- Mac 打开、编辑 .bash_profile 文件
- Shell date嵌套赋值
- megan的javaScript学习笔记一
- 缓存失效竟然可以这么解?