1

I am using NSDate to get the NSTimeInterval according to current time zone. But I'm getting information related to UTC. I'm using methods like "dateWithTimeIntervalSinceNow" and "dateWithTimeIntervalSince1970" How can I get time interval as per my time zone?

Satyam
  • 15,493
  • 31
  • 131
  • 244

2 Answers2

0

This has been answered in a fair bit of detail here.

How to convert time to the time zone of the iPhone device?

You might also want to check this out

Using TimeZones

Community
  • 1
  • 1
Manish Burman
  • 3,069
  • 2
  • 30
  • 35
-1

If both are NSDates then you could do :

//calculate the time difference in seconds, that is absolute and does not depend in time zones :)
double timeDiffInSecs = [date1 timeIntervalSince1970] - [date2 timeIntervalSince1970];
nacho4d
  • 43,720
  • 45
  • 157
  • 240