I have a Date object created by new Date();
When I do
String.valueOf(new Date())
I get
"Mon Jan 10 11:11:11 PST 2015"
Is there a way to format in the following way:
Monday Jan 10, 2015 at 5:15 PM
I tried DateFormat
and all its examples but not able to get it in the format required.
Date curDate = new Date();
System.out.println(curDate.toString());
String DateToStr = DateFormat.getInstance().format(curDate); System.out.println(DateToStr);
DateToStr = DateFormat.getTimeInstance().format(curDate); System.out.println(DateToStr);
DateToStr = DateFormat.getDateInstance().format(curDate); System.out.println(DateToStr);
DateToStr = DateFormat.getDateTimeInstance().format(curDate);
System.out.println(DateToStr);
DateToStr = DateFormat.getTimeInstance(DateFormat.SHORT).format(curDate);
System.out.println(DateToStr);
DateToStr = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(curDate);
System.out.println(DateToStr);
DateToStr = DateFormat.getTimeInstance(DateFormat.LONG).format(curDate);
System.out.println(DateToStr);
DateToStr=
DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.SHORT).format(curDate)
System.out.println(DateToStr);