I have a small IOS program and that get a time from a database server. I would like to convert that to the users localtime (I always know the timezone of the server).
I have been playing with replacing the hour piece of the string, but that seems like a bad idea.
In C# I would convert the string into a DateTime and add the hours in the diference between the server time and the localtime, but I simply cant figure out how to do that in ObjectiveC.
So could anyone give a few hints? The date/time string I get from the sever looks like this:
2011-02-27 12:10:02
I would convert the date from the string into and NSDate object using NSDateFormatter. The you can use the dateByAddingTimeInterval method to add in your hour. Also NSCalendar has more advanced functions for adding time intervals.