什么是JavaScript,等同于以下PHP代码:
$expTime = time() + (5 * 60 * 60); // now plus 5 hours (5 hour; 60 mins; 60 secs)
$expTimeStr = gmdate('Y-m-d\TH:i:s\Z', $expTime);
最佳答案
var expTime = new Date((+new Date()) + (5 * 60 * 60000))
var m = expTime.getMonth() + 1
var d = expTime.getDate()
var y = expTime.getFullYear()
var h = expTime.getHours()
var i = expTime.getMinutes()
var s = expTime.getSeconds()
var expTimeStr = y +"-"+ m +"-"+ d +" "+ h +":"+ i +":"+ s