ios - NSDateFormatter not giving proper response while setting date -


i have little bit problem. please @ here , understand problem.

    nsdateformatter *dateformatter = [[nsdateformatter alloc] init];     [dateformatter setlocale:[nslocale systemlocale]];     [dateformatter setdateformat:@"dd-mmm-yyyy"];     self.datepicker.userinteractionenabled=yes;     nsstring *datestring=[dateformatter stringfromdate:datepicker.date]; 

this block returning date. when set there nslocale not give me proper response.

i want date in dd-mmm-yyyy (24-mar-2008) formate. giving response :

ios8.0 , latter --> 24-m03-2004

ios7.0 , older --> 24-month03-2004

because of dependency cant remove [dateformatter setlocale:[nslocale systemlocale]]; above block. please suggest me how can handle problem,

try using

[dateformatter setlocale:[nslocale currentlocale]]; 

insteade of

[dateformatter setlocale:[nslocale systemlocale]]; 

this return format want.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -