nstimezone

In Cocoa, how do I use NSTimeZone to get the system time zone offset as a string?

For PDT, I would want "-0700". I'm getting a date in the past to determine how long ago something happened. NSDate *then = [NSDate dateWithString:@"1976-04-01 12:34:56 -0700"]; // Note the hard-coded time zone at the end I'll be constructing the date string elsewhere but I don't know how to access the local time zone. I read the App...

How to calculate the time difference between two locations.

I am having a problem with calculating time difference between two timeZones. If I am at location A I know the latitude and longitude and the current time. I go to location B I know the latitude and longitude and the current time. How to calculate the time difference between the two current points .. (in UTC) ...

iPhone NSTimeZone: localTimeZone confusion

From what I understand, calling NSLog(@"Local Time Zone %@",[[NSTimeZone localTimeZone] name]); gives you the local time zone of the device. What it's giving me is "US/Central", and I can't find that anywhere in the list of abbreviations in [NSTimeZone abbreviationDictionary], or the list of time zone names in [NSTimeZone knownT...

Getting city and country from NSTimeZone

I'd like to (at least) get the name of the country for a time zone. This is not provided by any of the potential methods: name, localizedName:locale:, description I notice that the built in iPhone clock App has access to this information, as it describes London as "London, England". Thanks. ...

Getting timezone information on iPhone for coordinates

For iPhone development: How can I get the timezone and DST information for any place given that I only have geographic coordinates. (NSTimezone does not have any such method) ...

ASP.NET Javascript DateTime TimeZone Issues

Hi All, I am having an issues passing a JSON containing DateTime to asp.net code-behind (c#). If the client browser is in the same timezone as the server I have no issue, but if they are in different timezones my time is getting modified by the offset value of the two timezones. But all my datetimes need to be the date with a time of ...

Getting wrong date with initWithTimeInterval: sinceDate:

Hi, I have a date, 2010-08-23 13:30:00 -0400 and I'm trying to get it in the UTC +2 time zone. The difference in seconds is 21600 but when I call [[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate];, I get 2010-08-24 01:30:00 +0200 which should be 2010-08-23 19:30:00 +0200. Any idea what I'm doing wrong? ...

Get Time Zone abbreviation given GMT offset with Objective C

Is there a way to lookup a timezone abbreviation when only the temporal offset is known? Example: Say i'm given the offset of GMT -5, i'd like to display the abbreviation of EST (assuming US) as apposed to GMT -5. If you initialize a NSTimeZone object with [NSTimeZone timeZoneWithName:@"America/Argentina/Buenos_Aires"], you can get th...

Convert NSDate to NSString with NSDateFormatter with TimeZone without GMT Time Modifier

I'm initializing my NSDateFormatter thusly: NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]]; [dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss z"]; [dateFormatter setTimeZone:[NSTimeZone timeZoneForSeco...

Local Time Zone iPhone

Hi all, I'm parsing an.ics file that includes time stamps of events like this: 20101008T230000Z This is, as far as I understand, expressed in UTC. Now, I want my app to display this time correctly, depending on the time zone where the iPhone user resides. So, as an example, if the user would be in London, the time would be displayed ...