dd/mm/yyyy vs dd/MM/yyyy?
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); String date = sdf.format(new Date()); System.out.println(date); Result is todays date i.e 23/03/2014 But when i do SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy"); result can be 23/05/2014, 23/05/2014, 23/06/2014 and son with each run of prgram. Why so? As we can see from the documentation , it's because mm is for minutes, not months. 1. d/D: day without 0 prefix on single digit. 2. dd/DD: day with 0 prefix if single digit. 3. M: Month without 0 prefix on single digit. 4. MM: Month with 0 prefix if single digit. 5. yy/YY: