Code example for SimpleDateFormat

Methods: format

0
  System.out.print(symbols.getMonths()[now.get(Calendar.MONTH)] + " ");
  System.out.println(now.get(Calendar.DATE) + ", " + now.get(Calendar.YEAR));
 
  //using DateFormat 
  Date date = new Date();
  DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
  System.out.println(format1.format(date));
  DateFormat format2 = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
  System.out.println(format2.format(date));
 } 
} 
Experience pair programming with AI  Get Codota for Java