Home  >  Article  >  Web Front-end  >  js returns the specific time corresponding to the timestamp_javascript skills

js returns the specific time corresponding to the timestamp_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:22:541020browse

As shown in the title, return the specific time corresponding to the unix timestamp:

Copy code The code is as follows:

var time = '1278927966';
//The key is to multiply by 1000, because time is relative to the beginning of 1970, so multiplying by 1000 will go to the current time.
var real_time = new Date(time) * 1000;
document.write(real_time);

The code is very simple to complete the conversion of timestamp.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn