开发者

Converting YYYY-MM-DD to unix timestamp in Javascript

I need to convert a date in format eg. 2011-01-02 to a unix timestamp in JavaScript but do not exactly know how to accomplish it. I can get the current timestamp using the following functions Math.round((new Date()).getTime() / 1000); but do not know how to convert the g开发者_Python百科iven date to a unix timestamp?


You can write new Date("2011-01-02").getTime() / 1000

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜