I am new to iOS development, being an Android developer I am used to use have an object that saves a datetime with a given timezone (from Joda-Time library).
After reading the iOS documentation about dates and times (https://developer.apple.com/documentation/foundation/dates_and_times) I still have doubts about which class should I use to save datetimes. Given the Date/NSDate class description "A specific point in time, independent of any calendar or time zone." it seems very useless because it is timezone independent and time without a timezone does not make any sense, since it does not have any context.
My real problem (TL;DR):
I have a database where date times are stored in UTC like this "yyyy-MM-dd hh:mm:ss". I would like to init an object with some kind of DateFormatter (string with this format "yyyy-MM-dd hh:mm:ss") plus a timezone (UTC) to easily convert to any Timezone that I want (to show to the user on his default timezone time). How can I accomplish this in iOS?
Edit: Imagine I have a class Event with a title and a start time. Title is a String, what start time should be?
Dateis a point in time. If I say "now", that is a point in time that is the same for everyone in the world. The timezone is irrelevant until someone wants to know "what time was that 'now' in my timezone?". Then you simply format thatDateinto aStringwith the given timezone. - rmaddyDate. It's a string. You will convert that string to aDatebased on a specific timezone. Once you have theDate, you store it. Later you retrieve it and you can convert thatDateto a string again for any timezone you want. That's the point. TheDateobject has no specific timezone and it doesn't need one. - rmaddyDatebeing UTC. It's not any timezone. It's just a point in time. Period. - rmaddyDateis represented as a time interval since a certain epoch in no way means that aDatecan be thought of as being in UTC time. - rmaddy