-1

I can save DATE with core data and all operation is working fine.

I can not save DATE as string as my fetch request will have filters on a DATE column.

Sqlite has a support of DateTime datatype but unfortunately, I can't save my IOS current dateTime. Any Suggestion?

Kanjariya-IOS
  • 652
  • 1
  • 5
  • 17

1 Answers1

0

Convert the NSDate into a string:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"ddMMyyyy"];
NSDate *date = [dateFormatter dateFromString:actualYearDate];
NSString *stringFromDate = [NSString stringFromDate:date];

And you can use this string. Date format you can choose as you want.

voltae
  • 582
  • 4
  • 11