I am creating an iOS application for tracking attendance. Each attendance record is stored in an object that has a status attribute (for example, present, absent) and an NSDate attribute called date , which indicates the day on which this attendance record was made. When I select a specific date (using a UIDatePickerView or similar), I want all attendance records (objects) for that date to be displayed in a table.
Although it sounds simple in principle, I ran into a problem with time zones. I know that NSDate is stored independently of time zones (i.e. they are stored relative to UTC / GMT +0000). This means that if I am in Sydney and visit, for example, Sunday, November 4, 2012, because the date is stored as independent of the time zone, if I take my iPhone / iPad to a different time zone (for example, in San Francisco) the records will move one day ago, in this case, Saturday, November 3, 2012, because it was the time when the attendance was held in San Francisco local time (which was actually the next day in Sydney local time).
I do not want this to happen - I want the date to be absolute. In other words, if the visit takes place on Sunday November 4, 2012, then it must remain on that date, no matter where in the world (and depending on what time zone) I can go. As you can see, this completely contrasts, say, with the calendar application, when it is desirable that the appointment dates change depending on the time zone.
Any suggestions on a better way to approach this issue would be appreciated. Please keep in mind that I select a date to display using a UIDatePickerView that returns the current NSDate in a time-independent format, so I also need a way to make an easy comparison (preferably in NSPredicate , since attendance objects are stored in Core Data) so that Get all attendance objects for that particular day.