I want to save the the current date and time in GMT in my core data. The field for current date in the table is set as Date field. I have no chance to change the field in to NSString
.
NSDate *memberShipDate = [NSDate dateWithTimeIntervalSince1970:[intervalString doubleValue]];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[formatter setTimeZone:gmt];
NSString *newmemberShipDate = [formatter stringFromDate:memberShipDate];
Here the newmemberShipDate
is in NSString
format. When I am trying to save this data to my db, it will become error. I need the newmemberShipDate
in NSDate
format.