Wednesday, 28 August 2013

NSDate showing null always

NSDate showing null always

I am using ns date concept in my application. In one of my classes I have
set the nsdate date for a date instance and I use it in the next class. It
works perfect for me but if I use that date its giving me 5.30 hrs before
time so I used a date formatter to change it but I'm getting a null
response.
NSLog(@"update date=
%@",pullToRefreshManager_.pullToRefreshView.lastUpdateDate);
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormat setTimeZone:timeZone];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *str=[NSString
stringWithFormat:@"%@",pullToRefreshManager_.pullToRefreshView.lastUpdateDate];
NSLog(@"Str== %@",str);
NSDate *date = [dateFormat dateFromString:[NSString
stringWithFormat:@"%@",str]];
NSLog(@"exact date= %@",date);
Pls help
Thanks in advance

No comments:

Post a Comment