时间戳的计算

来源:互联网 发布:淘宝评论福利怎么领取 编辑:程序博客网 时间:2024/06/05 23:00
时间戳的计算

mysql:
select unix_timestamp();
select unix_timestamp('1986-10-05 10:43:23');
select from_unixtime(unix_timestamp());
select from_unixtime(528864203,'%Y年%m月%d日 %H时%i分%s秒');

php:
echo time();
echo strtotime('1986-10-05 10:43:23');
echo date('Y-m-d H:i:s',528864203);

javascript:
timestamp = Math.round(new Date().getTime()/1000) = 秒;
timestamp = Math.round(new Date('1986/10/05 10:43:23').getTime()/1000) = 秒;
原创粉丝点击