Here is the code I used to change the date format.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @"YYYY-MM-dd HH:mm"];
NSString *endDate = [formatter stringFromDate:[NSDate date]];
----------Output---------------
(lldb) po [NSDate date] 2015-12-27 05:24:18 +0000
(lldb) po endDate 2016-12-27 11:09
This issue was fixed when I used @"yyyy-MM-dd HH:mm" but I did not understand why a whole year is changed when week based year is used. This issue also occurs for date Dec (27-31) 2020.