Reputation: 3006
Few questions:
Example: 2011-05-04 19:12:46 -0500
Format: YYYY-MM-DD HH:MM:SS [+|-]hh[mm]
Upvotes: 1
Views: 635
Reputation: 10762
Check out SimpleDateFormat: http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
SimpleDateFormat.format() and SimpleDateFormat.parse()
Upvotes: 3
Reputation: 59576
Try:
Date yourDate = new Date(...);
SimpleDateFormat myDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
System.out.print(myDateFormat.format(yourDate);
The link to SimpleDateFormat Javadoc is here.
Upvotes: 6