Reputation: 10828
For an iPhone chat app I'm working on, I want to know how to handle all the timezone issue. I mean how to make that when client1 sends a message to client2, they both see the correct time (date) next to the message.
So far this is what i think i need to do:
DateTime.UtcNow
.Is this the way to do that?
What is the best way to send the date from server to client? In the server the date is save to the database as DateTime
object, to what format can I convert it to send it to the client?
Upvotes: 0
Views: 1058
Reputation: 5245
You have a couple options here depending on how accurate the reported time needs to be:
In terms of sending dates back and forth, check out the documentation on NSDateFormatter. You can use a format that it can consume easily or do whatever's easiest on the server and use a custom dateFormat
property on the formatter to parse as you please.
Upvotes: 2