swift - need to convert UTC time to current timezone of device -
im using repo
https://github.com/remirobert/tempo
can me understand how grab current time zone of device, , notify tempo? using timeagonow() function of tempo find display how long ago post made, timezone difference messing up. datasource using utc time.
cocoa uses utc internally. of date/time calculations.
if create nsdate now:
nsdate()
you date number of elapsed seconds since midnight, 1970 in utc time.
dates have time zones when display them.
by default logging date console logs in utc, can confusing.
if i'm working on project lot of date/time calculations i'll create debugging method converts nsdate date/time string in current locale, easier read/debug without having mentally convert utc local time.
i have never used tempo, don't know if using date strings, nsdate, or "internet dates" (which in utc, use different "zero date" or "epoch date")
Comments
Post a Comment