Background issued by the time format such as: 2016-09-15 15:30:10;
Not much, just use the new date (' 2016-09-15 15:30:10 '). GetTime () gets the timestamp;
Development time, computer debugging OK, when put to touch screen debugging, Androidok, but iOS also die, the result is: Nan-nan1-nan Invalid Date
What?
Later learned: iOS can read the format is: 2016/09/15 15:30:10
Well, that one is written as a uniform method of converting timestamps to invoke:
Exports.exchangetime = function (date) { if (date) { //2016-09-15 15:30:10 var date_1 = date.split (') [0], date_2 = Date.split (") [1]; var y = date_1.split ('-') [0], m = date_1.split ('-') [1], d = date_1.split ('-') [2], h = date_2.split (': ') [0], i = date_2.split (': ') [1], s = date_2.split (': ') [2]; } else{ var now_date = new Date (); var y = now_date.getfullyear (), m = now_date.getmonth () + 1, d = now_date.getdate (), h = now_date.gethours (), i = now_date.getminutes (), s = now_date.getseconds (); } return Date.utc (Y, M, D, H, I, s); }
Safari conversion timestamp problem in iOS