时间戳的计算

时间戳的计算

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) = 秒;

版权声明:本文为ownfire原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。