i wondering, there means store time in firebase using swift? reason why ask because want make application when create particular object, object start timer counts down 24 hours of when created. when 24 hours expire, object deleted. want show count down timer show how longer object has left before it's deleted.
i tried storing hour , minutes integers database doesn't seem efficient since have worry am/pm, , possibly have worry day is. thinking storing date string seems arduous in figuring out how change string integer , decrement time show countdown way.
i've looked firebaseservervalue.timestamp()
can't seem store firebase. there tips or ideas on how 1 implement this? thanks.
edit: attempt store firebaseservervalue.timestamp()
firebase:
self.firebaseref.childbyautoid().setvalue([ "individualid":individualid.text, "timecreated": firebaseservervalue.timestamp() ])
however error saying '_' not convertible 'stringliteralconvertible'
. tried see if timestamp had methods turn string or integer couldn't find thought useful autocomplete.
you can use time interval , store number
var interval = nsdate().timeintervalsince1970
and when need date this
var date = nsdate(timeintervalsince1970: interval)