2012-12-09 3 views

Répondre

0
// (1) get today's date 
Date today = Calendar.getInstance().getTime(); 

// (2) create our date "formatter" (the date format we want) 
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy"); 

// (3) create a new String using the date format we want 
String result = formatter.format(today); 

// (4) this prints "Result = Sun Sep 06 08:32:51 2009" in English and will be translated depending on phone Locale 
System.out.println("Result = " + result); 

Source: http://alvinalexander.com/java/simpledateformat-convert-date-to-string-formatted-parse

Questions connexes