python日期转换
2015-02-15 15:05
211 查看
发现自己每当遇到python日期转换的问题时,都会记不住,然后百度……。有时哪怕是相同的问题,一段时间也会记不住,所以打算把以后遇到的转换问题都记下来,希望日后有所帮助。
日期字符串 -> 秒数(例如:20150215 -> 1423929600):
日期字符串 -> 秒数(例如:20150215 -> 1423929600):
#!/bin/env python #coding=utf8 from datetime import datetime def dateStrToSeconds(date_str): return int(datetime.today().date().strftime("%s"))
#!/bin/bash date_str=`date +%Y%m%d` seconds=`date +%s -d $(date_str)`
相关文章推荐
- python日期时间字符串转换成unix时间戳
- python转换时间戳和日期时间格式的转换
- python实现字符串和日期相互转换的方法
- python 日期加减与转换为str
- Python时间,日期,时间戳之间转换
- python时间戳与日期转换
- Python 2.7 日期格式化 字符串日期转换
- python日期转换
- Python时间戳和日期的相互转换
- Python时间戳和日期的相互转换
- python转换时间戳和日期时间格式的转换
- Python时间,日期,时间戳之间转换
- Python时间,日期,时间戳之间转换
- Python 将毫秒转换成日期
- Python时间戳和日期的相互转换
- python 字符串和日期之间转换 StringAndDate
- python excel中日期的转换
- Python时间,日期,时间戳之间转换
- python json及mysql——读取json文件存sql、数据库日期类型转换、终端操纵mysql及python codecs读取大文件问题
- Python时间,日期,时间戳之间转换