puks1978
puks1978

Reputation: 3697

How to store users current timezone in Swift

In an app I am developing I am using push notifications for a bunch of things however, with some of the apps I use, push notifications come at any time of the day which is quite annoying.

I would like to only push notifications to users between say 9am and 6pm however I would like this to be in their local time.

What would (and how) be the best way to get this information from a user when they register and store it in a DB?

Would getting their current location and set this dynamically be a good idea and if they change timezones update accordingly?

Thanks

Upvotes: 2

Views: 61

Answers (1)

Moriya
Moriya

Reputation: 7906

You could get seconds from GMT and store that

NSTimeZone.localTimeZone().secondsFromGMT

Upvotes: 2

Related Questions