1 varChangetimes =function(time) {2 vartemp = time.split (' ');3 vararr = Temp[0].split ('-');4 varBRR = Temp[1].split (': '));5 if(Brr.length = = 3){6 vartimestamp =NewDate (DATE.UTC (arr[0], arr[1]-1, arr[2], +brr[0]-8, brr[1], brr[2]));7}Else if(Brr.length = = 2){8 vartimestamp =NewDate (DATE.UTC (arr[0], arr[1]-1, arr[2], +brr[0]-8, brr[1]));9 }Ten vartimestamp = Timestamp.gettime ()/1000; One returntimestamp; A};
DATE.UTC function (JavaScript)
Returns the number of milliseconds between midnight of January 1, 1970 Coordinated Universal Time (UTC) (or GMT) and the specified date.
Grammar:
Notes
DATE.UTCThe function returns the number of milliseconds from midnight UTC January 1, 1970 to the provided date. If the parameter value is greater than its range or is negative, the other stored values will be modified accordingly.
The difference between the date.utc function and the Date object constructor that accepts dates is that thedate.utc function takes UTC, and the date object constructor takes local time.
JS Convert time to Timestamp