I've already searched StackOverflow.com for an answer to this question, still without any success. Already looked here:
iOS - Converting time and date to user time zone
Get current iPhone device timezone date and time from UTC-5 timezone date and time iPhone app?
Nothing of those worked.
So I have this NSString date format: 2014-05-07T10:28:52.000Z
trying to convert it to NSDate, this is what I'm using:
+ (NSDate*)stringToDate:(NSString*)string format:(NSString*)format
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:format];
return [dateFormatter dateFromString:string];
}
This is how I'm using it:
NSDate *date = [AppUtils stringToDate:youtube.postDate format:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
I've also tried those formats:
yyyy-MM-dd'T'HH:mm:ss.ZZZ
yyyy-MM-dd'T'HH:mm.ss.ZZZ
yyyy-MM-dd'T'HH:mm.ssZZZ
How could I convert it to NSDate successfully?
Thanks in advance!