Home > Web Front-end > JS Tutorial > body text

js returns the specific time corresponding to the timestamp_javascript skills

WBOY
Release: 2016-05-16 18:22:54
Original
1045 people have browsed it

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.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!