python 输出上个月的月末日期实例
2018-04-11 10:41
926 查看
如下所示:
import dateutil def before_month_lastday(ti): today=dateutil.parser.parse(str(ti)) first = datetime.date(day=1, month=today.month, year=today.year) lastMonth = first - datetime.timedelta(days=1) cc=str(lastMonth.year)+str(lastMonth.month)+str(lastMonth.day) return int(cc) print(before_month_lastday(20171011))
2017930
以上这篇python 输出上个月的月末日期实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
相关文章推荐
- python 输出上个月的月末日期
- python日期时间转为字符串或者格式化输出的实例
- python时间格式输出 以及递增 日期加一天
- python 捕获shell脚本的输出结果实例
- Python进阶(三十三)-Python获取并输出当前日期时间
- Python计算两个日期相差的天数,并输出到txt文档中
- python 把数据 json格式输出的实例代码
- python3.4学习笔记(二十六) Python 输出json到文件,让json.dumps输出中文 实例代码
- python 美化输出信息的实例
- Python获取并输出当前日期时间
- Python输出带颜色的字符串实例
- python 捕获 shell/bash 脚本的输出结果实例
- Python实例讲解 -- 获取本地时间日期(日期计算)
- Python实例讲解 -- 获取本地时间日期(日期计算)
- python dataframe中找出月末日期
- python遍历一个目录,输出所有的文件名的实例
- P_005.Python获取并输出当前日期时间
- python让列表倒序输出的实例
- python中日期和时间格式化输出的方法小结
- python 计算两个日期相差多少个月实例代码