-2

Good evening everyone!

My form sends a String list in this format:

dd/ MM / yyyy

Wanted converts this string list in date to the format :

yyyy - MM - dd

How can I do this in Java ?

AmandaRJ
  • 209
  • 3
  • 13

1 Answers1

0
File file = new File("/Users/eclipse-workspace"); // Absolute path
long lastModified = file.lastModified();    // File into lastModifiedDate lastModifiedDate = new Date(lastModified);    //
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  // Display format 
String formattedDate = dateFormat.format(lastModifiedDate);     // 
System.out.print("Last Modified Date :"+ formattedDate);    // 
f.khantsis
  • 3,256
  • 5
  • 50
  • 67
Wassim Jied
  • 25
  • 1
  • 5
  • But to do it with a List < String> ? I have a List < String> Xy , this List I will use a "For " to convert each value in Date to enter in my database. – AmandaRJ Sep 22 '16 at 22:51
  • SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String dateInString = "your_date"; try { Date date = formatter.parse(dateInString); System.out.println(date); – Wassim Jied Sep 22 '16 at 22:59