Home > Web Front-end > JS Tutorial > body text

js converts the current time format into time (self-written)_javascript skills

WBOY
Release: 2016-05-16 17:21:11
Original
1025 people have browsed it

A method I wrote myself

Copy the code The code is as follows:

function split_time(time){/ /Convert the current time to time, for example, 2013-09-11 12:12:12
var arr=time.split(" ");
var day=arr[0].split("-") ;
var hour=arr[1].split(":");
return Date.UTC(day[0],(day[1]-1),day[2],hour[0] ,hour[1],hour[2])/1000; //Convert the current time into time
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template