There are many requirements for time stamping and standard time conversions in the development process, and slightly larger projects will introduce similar moment.js, but for simple H5 pages, more simple ways to process dates
/*timestr: Time, format can be: "September 16,2016 14:15:05," September 16,2016 "," 2016/09/16 14:15:05 "," 2016/09/16 "," 2014-04-23t18:55:49 ' and milliseconds DateSeparator: delimiter between year, month, and day, default to '-', TimeSeparator: delimiter between hours, minutes, seconds, default to ': '*/functiongetformatdate (Timestr, DateSeparator, TimeSeparator) {DateSeparator= DateSeparator? DateSeparator: "-"; TimeSeparator= TimeSeparator? TimeSeparator: ":"; varDate =NewDate (TIMESTR), year= Date.getfullyear (),//Get the full year (4-bit, 1970)month = Date.getmonth (),//get the month (0-11, 0 for January, remember to add 1 when using)Day = Date.getdate (),//Get Day (1-31)hour = Date.gethours (),//gets the number of hours (0-23)minute = Date.getminutes (),//gets the number of minutes (0-59)seconds = Date.getseconds (),//gets the number of seconds (0-59)Y = year +DateSeparator, M= ((month + 1) > 9? (month + 1): (' 0 ' + (month + 1)) +DateSeparator, D= (Day > 9-day: (' 0 ' + day) + ", H= (Hour > 9? Hour: (' 0 ' + hour)) +TimeSeparator, M= (Minute > 9? minute: (' 0 ' + minute)) +TimeSeparator, S= (seconds > 9? seconds: (' 0 ' +seconds)), FormatDate= Y + M + D + H + M +s; returnformatdate;}
JS time stamp, date to convert each other