Muhammad Salman
Muhammad Salman

Reputation: 553

Working with DateTime picker

I am making an app in which user select the time and than I convert time into string using this code.

 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.timeZone = [NSTimeZone localTimeZone];
    dateFormatter.timeStyle = NSDateFormatterShortStyle;
    NSString * dateTimeString = [dateFormatter stringFromDate:timePicker.date];

and than I save the dateTimeString in coreData. Now I want to that "datetimestring" again converted into picker form like that

how can I achieve that?? Is there a way to convert the time string into a picker form??

Upvotes: 0

Views: 247

Answers (1)

dasdom
dasdom

Reputation: 14073

Just use dateFromString of a similar NSDateFormatter instance.

By the way, you can store instances of NSDate in Core Data directly.

Upvotes: 4

Related Questions