ios - How can I get current month as number ie. "1" in objective c? -


this question has answer here:

how can current month not "jan" want in format "1", in short want current month as number because want append number string complete url link json parsing. thank in advance.


try month number

nsdate *date = [nsdate date]; nsdateformatter *datefor = [[nsdateformatter alloc]init]; [datefor setdateformat:@"mm"]; //[datefor setdateformat:@"m"]; // use single m avoid 0 before month number nsstring *monthnumber = [datefor stringfromdate:date]; 

hope help..


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -