In IPhone (Objective C), how can I get the current date formatted in milliseconds to send to a web service rest server?


I am new to IPhone development. I need to take the current date from device and send to a server in JSon format. The server expects this date to be in milliseconds as since January 1, 1970, 00:00:00 GMT(Unix time) .

I have noticed IPhone has some methods to get the current time in SECONDS, well, should be very easy to transform seconds to milliseconds with a simple * 1000 routine. All the problem begins because as this is my first lines of code with Objective-C for IPhone I am lost trying to get current time in seconds.

How do I get current time in milliseconds in IPhone?

Thanks in advance.

double milliseconds = 1000.0 * [[NSDate date] timeIntervalSince1970];