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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -