- javascript:
a. 代码:
var strtime = '2018-01-01 00:00:00';
var date = new Date(strtime);
var time = date.getTime().toString();
time = time.slice(0,10)
console.log(time)
b. 输出:
1514736000
- php:
a. 代码:
$time = strtotime("2018-01-01 00:00:00");
echo $time;
b. 输出:
1514736000
|