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
精彩评论