时间戳与字符串时间转换
pythonimport datetimeimport timea = '2020-04-08 15:28:59'stamp = int(time.time())print(datetime.datetime.fromtimestamp(stamp))print(time.strftime("%Y-%m-%d %H:%M", time.localtime(stamp)))pri...
·
python
import datetime
import time
a = '2020-04-08 15:28:59'
stamp = int(time.time())
print(datetime.datetime.fromtimestamp(stamp))
print(time.strftime("%Y-%m-%d %H:%M", time.localtime(stamp)))
print(time.mktime(time.strptime(a,'%Y-%m-%d %H:%M:%S')))
php
date_default_timezone_set('Asia/Shanghai');
$stringtime = date("Y-m-d H:i:s",time());
echo $stringtime."<br/>";
echo strtotime($stringtime)."<br/>";
echo date("Y/m/d G:i:s A",strtotime($stringtime));
更多推荐
已为社区贡献1条内容
所有评论(0)