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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -