<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="utf-8"> <title>js时间格式化函数,支持Unix时间戳</title> </head>…
var curTime = new Date(); //2把字符串格式转换为日期类 var startTime = new Date(Date.parse("2018-3-28 16:44")); var endTime = new Date(Date.parse("2018-3-28 16:45")); console.log(startTime) console.log(endTime ) //3进行比较 console.log(curTime >= st…
一.判断数据类型: 常见的判断有typeof.instanceof. constructor. prototype,先来看typeof: var a = "hello world"; var b = 10; var c = [1, 3, 5]; var d = new Date(); var e = function() {}; console.log(typeof a); // string console.log(typeof b); // number console.log(t…