Given DateTime, how to format date in the following format ?
12 JUL 2013
in c#, you do this
string formatedDateString = String.Format("{0:dd MMM yyyy}", myDateTime);
What is the equivalent code in JAVA ?
Given DateTime, how to format date in the following format ?
12 JUL 2013
in c#, you do this
string formatedDateString = String.Format("{0:dd MMM yyyy}", myDateTime);
What is the equivalent code in JAVA ?
And date
represents instance of java.util.Date
String formattedDate = new SimpleDateFormat("dd MMM yyyy").format(date);
Use a SimpleDateFormat. Along the lines of
(new SimpleDateFormat("dd MMM yyyy")).parse("12 JUL 2013");
(new SimpleDateFormat("dd MMM yyyy")).format(new Date());