objective c - Returns NULL value -


i null value when print log sourcedate. give null value.

the code is:

nsmutablestring * orignalstr = [[nsmutablestring alloc] init]; [orignalstr appendstring:date]; [orignalstr replaceoccurrencesofstring:@"t"                             withstring:@" "                                options:nscaseinsensitivesearch                                  range:nsmakerange(0, 15)]; nslog(@"the orignalstring =%@ ",orignalstr);  nsdateformatter* dateformatter=[[nsdateformatter alloc]init]; [dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss zzz "];  nsdate *sourcedate =[dateformatter datefromstring:orignalstr]; nslog(@"the sourcedate =%@ ",sourcedate); 

plz me...

try using date format string : @"yyyy'-'mm'-'dd't'hh':'mm':'ss'z'", without replacing occurences of @"t".

edit after comment

you got string : "2011-07-19 gmt:10:00", format string should @"yyyy'-'mm'-'dd' gmt:'hh':'ss".


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

ASP.NET Javascript: window.open won't work twice -

jquery - Opera does not change the height of the page. Why? -