I downloaded date information from an API which is in the format of (Java)
day month monthnumber hour:minute:second EST year
how can I format this into just
month monthnumber year
I downloaded date information from an API which is in the format of (Java)
day month monthnumber hour:minute:second EST year
how can I format this into just
month monthnumber year
You could use SimpleDateFormat
to first parse the string to a java.util.Date
, and then format it to the format you want:
String orig = "Thu Feb 19 19:40:12 EST 2015";
SimpleDateFormat parser = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
Date date = parser.parse(orig);
SimpleDateFormat formatter = new SimpleDateFormat("MMM dd yyyy");
String formatted = formatter.format(date);