fork download
  1. import java.time.LocalDate;
  2.  
  3. class Main {
  4. public static void main(String args[]) {
  5. String strDateTime = "2009-06-22";
  6. LocalDate date = LocalDate.parse(strDateTime);
  7. System.out.println(date);
  8. System.out.printf("Day: %d, Month: %d, Year: %d", date.getDayOfMonth(), date.getMonthValue(), date.getYear());
  9. }
  10. }
Success #stdin #stdout 0.13s 49364KB
stdin
Standard input is empty
stdout
2009-06-22
Day: 22, Month: 6, Year: 2009