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


For PDT, I need "-0700".

I'm getting a date last to determine that something happened sometime ago.

  NSDate * then = [NSDate dateWithString: @ "1976-04-01 12:34:56 -0700"]; // Note the hard-coded time zone at the end  

I will create a second string string, but I do not know how the local time zone has reached.

I read the Apple Dates and Times programming topics for context with reference to NectemeZone and NSDT category, but it is very difficult to combine with information. I actually use some lines of code to show only this How I Can Use It

Update : While struggling with this, I was writing the code using the command line template so that I could try things quickly, I just wanted to put my last code on the iPhone Tried and could not answer me for NSDate '+ dateWithString:' , if he was involved in confusion, who knew Apple would change such a basic class.

The only correct way is to generate the whole string together from the date and time zone. Use NSDateFormatter for this.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -