All Questions

138
votes
5answers
35412 views

What is the best way to deal with the NSDateFormatter locale "feechur"?

It seems that NSDateFormatter has a "feature" that bites you unexpectedly: If you do a simple "fixed" format operation such as: NSDateFormatter* fmt = [[NSDateFormatter alloc] init]; [fmt setDateFor...
7
votes
5answers
6375 views

NSDate Format outputting wrong date

I have a NSString (ex. "2011-04-12 19:23:39"), and what I did to format it to a NSDate was the following: [inputFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *date = [inputFormatter dateFr...
38
votes
5answers
44531 views

NSString to NSDate

I got a string that contains the current date by using this : NSString *date = [[NSDate date] description]; At a different point I want to retrieve the date from this string and I used the followin...
30
votes
1answers
8126 views

NSDateFormatter show wrong year

im using xcode 4.5(4G182) with iOS 6. NSDateFormatter show wrong year in iOS 6, how to solve? NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateForm...
46
votes
8answers
28542 views

Is there a simple way of converting an ISO8601 timestamp to a formatted NSDate?

If I use the following code: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm"]; NSDate *myDate = [dateFormatter dateFromString:@"...
130
votes
8answers
294777 views

Formatting NSDate into particular styles for both year, month, day, and hour, minute, seconds

I basically need to get current date and time separately, formatted as: 2009-04-26 11:06:54 The code below, from another question on the same topic, generates now: |2009-06-01 23:18:23 +...
48
votes
7answers
41076 views

How to parse a date string into an NSDate object in iOS?

I am trying to parse a date string from xml into an NSDate object in an iPhone app I am aware this must have been asked before, however, I believe I have the right syntax, but it is not working. Is t...
48
votes
4answers
25360 views

Difference between 'YYYY' and 'yyyy' in NSDateFormatter

What is exact difference between 'YYYY' and 'yyyy'. I read in this link, it states that A common mistake is to use YYYY. yyyy specifies the calendar year whereas YYYY specifies the year (of “...
1
votes
2answers
639 views

Unexpected value from NSDate

I'm trying to store a time in a date. In this case 1.5 seconds. I store the time in the date like this: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@...
6
votes
2answers
696 views

Convert string with unknown format (any format) to date

I have data that contains a date string. Normally it would be in a 'Jan. 3, 1966' type format, but because of international differences, it may not always be exactly that. I need to read the dat...

Previous Next