ios - Change date format using NSDateFormatter -


i want use date format 2015-08-14 unfortunately getting format 16/11/15

below code have used desired output.

nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd"];  nstimezone *gmt = [nstimezone timezonewithabbreviation:@"gmt"]; [dateformatter settimezone:gmt];  [dateformatter setdatestyle:kcfdateformattershortstyle];  nsstring *formatteddatestring = [dateformatter stringfromdate:selecteddate]; 

can please suggest how fix issue?

enter image description here

just remove line [dateformatter setdatestyle:nsdateformattershortstyle];


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -