Poor Answer
how to get this in the format "12/26/2013 5:00 AM"?
To directly answer your question… To do so on the Java side on the server (as opposed to client-side in JavaScript), use the bundled classes java.text.DateFormat and java.text.SimpleDateFormat.
Better Answer: Joda-Time
A better answer is to tell you to avoid java.util.Date and java.util.Calendar classes. They are notoriously badly designed and implemented. Instead use a good date-time library. In Java that means either Joda-Time (open-source third-party library) or the new java.time.* classes defined by JSR 310 and bundled with Java 8 and meant to supplant the old j.u.Date/Calendar.
If you literally want only the format like "12/26/2013 5:00 AM", you can define a pattern in Joda-Time. You'll find many examples of this in other questions here on StackOverflow.com.
If you know the user's Locale and time zone name you can use those to format the date as a familiar string presentation.
Example code…
// © 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so.
// import org.joda.time.*;
// import org.joda.time.format.*;
DateTime now = DateTime.now();
// Style is defined by a pair of letters, one for date portion, the other for time portion.
// Letters are the first letter from: Short/Medium/Long/Full
// This example might be appropriate for a French person in Puducherry India (formerly Pondicherry, ex-colony of France).
DateTimeFormatter formatter = DateTimeFormat.forStyle( "SS" ).withLocale( Locale.FRENCH ).withZone( DateTimeZone.forID( "Asia/Kolkata" ) );
String dateTimeString = formatter.print( now );
System.out.println( "dateTimeString: " + dateTimeString + " for: " + now );
// By comparison.
DateTimeFormatter formatter_FF = DateTimeFormat.forStyle( "FF" ).withLocale( Locale.FRENCH ).withZone( DateTimeZone.forID( "Asia/Kolkata" ) );
String dateTimeString_FF = formatter_FF.print( now );
System.out.println( "dateTimeString_FF: " + dateTimeString_FF + " for: " + now );
When run (with my default time zone being US west coast)…
dateTimeString: 26/12/13 02:35 for: 2013-12-25T13:05:09.282-08:00
dateTimeString_FF: jeudi 26 décembre 2013 02 h 44 IST for: 2013-12-25T13:14:41.841-08:00
Experiment
Experiment if you wish. For United States, try local of Locale.US
and time zone of America/New_York
or America/Indiana/Knox
.