-7

I am very new to Objective C.

I am passing date in the format "YYYY-MM-DD" from webservice to apps (Objective C). How do I convert this to date format in Objective C?

Some help would be appreciated. :)

Regards, SG

TECH-SOS
  • 21
  • 1
  • 4

1 Answers1

0

You can use "dateFromString" function as below:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [formatter dateFromString:@"2012-02-06"]; 
[formatter release];
Mital
  • 241
  • 1
  • 5