//Timestamp converted to datetime 2014-8-8 PM 11:40:20functionFormatDate (NS) {return NewDate (parseint (NS) *). toLocaleString (). Replace (/year | month/g, "-"). Replace (/day/g, "");}//Timestamp converted to eight-bit date 2014-5-5functionuserdate (uData) {varMyDate =NewDate (udata*1000); varYear =mydate.getfullyear (); varmonth = Mydate.getmonth () + 1; varDay =mydate.getdate (); returnYear + '-' + month + '-' +Day ;}//Timestamp converted to four-bit time 10:10functionUsertime (utime) {varMyDate =NewDate (utime*1000); varHours =mydate.gethours (); varminutes =mydate.getminutes (); returnHours + ': ' +minutes;}//Timestamp converted to four-bit time 10:10:00functionUsertime (utime) {varMyDate =NewDate (utime*1000); varHours =mydate.gethours (); varminutes =mydate.getminutes (); varSecond =mydate.getseconds (); returnHours + ': ' + minutes + ': ' +second;}//timed Reminder Set time incoming (2014,05,15) returned to 2014-01-21functionsetDate (year,month,day) {returnYear + '-' + month + '-' +Day ;}//timed Reminder Set time incoming (01:02) return to 01:01:00functionsettime (hour,minute) {returnHour + ': ' + minute+ ': 00 ';}//time format 2014-02-02 14:10:00 change to timestampfunctionJs_strto_time (str_time) {varNew_str = Str_time.replace (/:/g, "-"); New_str= New_str.replace (//g, "-");vararr = New_str.split ("-"); varDatum =NewDate (DATE.UTC (arr[0],arr[1]-1,arr[2],arr[3]-8,arr[4],arr[5])); returnStrtotime = Datum.gettime ()/1000;}//Timestamp changed to time format 2014-12-12 pm 01:10functionJs_date_time (unixtime) {varTimestr =NewDate (parseint (unixtime) * 1000); vardatetime = Timestr.tolocalestring (). Replace (/year | month/g, "-"). Replace (/day/g, "" "); returndatetime;}
Conversion between JS timestamp and time format