Home  >  Article  >  Web Front-end  >  Javascript millisecond usage examples_javascript skills

Javascript millisecond usage examples_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:15:491549browse

The example in this article describes the usage of Javascript milliseconds. Share it with everyone for your reference. The details are as follows:

Milliseconds are the number of milliseconds between the specified date and time and midnight on January 1, 1970 (GMT time).

1. The number of milliseconds of the current system time

var myData = new Date(); 
var times = myData.getTime();//当前时间的毫秒数

2. The number of milliseconds in the specified time

var time = "2014-02-27 11:50:21"; 
var times = Date.parse(new Date(time.replace(/-/g, "/")));//指定时间的毫秒数

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn