开发者

Timestamp to date with Javascript. How?

开发者 https://www.devze.com 2023-02-19 09:02 出处:网络
I create a timestamp with开发者_开发知识库 strtotime php function. My question is how to \"reverse\" timestamp to year, month, date, ... seconds etc using javascript ?var date = new Date(phptimestamp*

I create a timestamp with开发者_开发知识库 strtotime php function. My question is how to "reverse" timestamp to year, month, date, ... seconds etc using javascript ?


var date = new Date(phptimestamp*1000);
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
//etc...


var date = new Date(seconds*1000);

where milliseconds is seconds since Jan 1970.


var date = new Date(timestamp*1000);
0

精彩评论

暂无评论...
验证码 换一张
取 消