js时间戳的相互转换

来源:互联网 发布:php判断字符是否整数 编辑:程序博客网 时间:2024/06/01 14:07

代码为项目中使用,其中含有变量

var endDate = nyear + "-" + nMonth + "-01";var time_a = Date.parse(new Date(endDate));// @program将时间格式转换为时间戳,js获取时间戳单位为msvar time_b = time_a-(24*60*60*1000);      //@将时间向前推一天var newDate = new Date();                //@获取时间格式     newDate.setTime(time_b);            //@把时间var time_c = newDate.toISOString();     //@最后把时间复制过来    endDate = time_c.substring(0,10);

查询某一个月内的数据