1、将标准时间转成时间戳 将‘2017-2-1’转化为时间戳 new Date('2017-2-1').getTime() 2、获取当前时间的时间戳 var timestamp = Date.parse(new Date());