ios - Got wrong date from FirebaseServerValue.timestamp() by Swift -


now i'm working on ios app swift firebase.com end

first tried put time function

var userhistoryforupdate = ["dealdate":firebaseservervalue.timestamp()]  userhistoryref.updatechildvalues(userhistoryforupdate [nsobject : anyobject], withcompletionblock: {     (error:nserror?, ref:firebase!) in     if (error != nil) {      } else {      } }) 

and in other views retrieve time function

var temppubdate = self.pubdataarray[indexpath.row]["dealdate"] as! double  dateformatter.dateformat = "dd mmm yy"  var dealdateandtime = nsdate(timeintervalsince1970: temppubdate)  cell?.historydate.text = "\(self.dateformatter.stringfromdate(dealdateandtime))" 

and cell display

enter image description here

as see got 23 jan 38 not today.

anyone know how can correct date firebase thanks!

timeintervalsince1970 takes seconds, while timestamp firebase in milliseconds.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -