我正在尝试确定一个数学公式来转换UTC中的纪元时间戳并获取当天的当前时间。
例如,我有这个时间戳,以毫秒为单位function checkIfVerified(req, res) {
var user_id = req.user.id
var options = {
method: 'GET',
url: 'https://MYDOMAIN/api/v2/users/' + user_id + '?fields=email_verified&include_fields=true',
headers:
{
authorization: 'Bearer ' + app.locals.token
},
body:
{
},
json: true
}
function check(callback) {
request(options, function (error, response, body) {
return callback(null, body)
})
}
var email_verified = check(function (err, data) {
if (!err) {
return data
}
})
console.log(email_verified)
return email_verified
}
,即:
1528567668862
我希望它能归还给我GMT: Saturday, June 9, 2018 6:07:48.862 PM
Your time zone: Saturday, June 9, 2018 11:07:48.862 AM GMT-07:00 DST
。