date的详细用户可以参考下面的 http://www.cnblogs.com/xd502djj/archive/2010/12/29/1919478.html date 的具体用法可以查看另外一篇博文 <shell date 命令详解>http://blog.csdn.net/runming918/article/details/7223520 date +%s 可以得到UNIX的时间戳;用shell将时间字符串与时间戳互转: date -d "2010-10-18…
1.当前时间换时间戳 var timestamp = parseInt(new Date().getTime()/1000); // 当前时间戳 document.write(timestamp); 2.当前时间换日期字符串 var now = new Date(); var yy = now.getFullYear(); //年 var mm = now.getMonth() + 1; //月 var dd = now.getDate(); //日 var hh = now.getHours(…
字符串形如:2016-06-20 10:41 转换为时间戳: var date = "2016-06-20 10:41"; date = date.substring(,); date = date.replace(/-/g,"/"); var timestamp = new Date(date).getTime(); console.log(timestamp/)…