Date Format

Hi

I want to display dates in 2 formats

format 1: DATE(MM/DD/RRRR):HR:MM AM/PM
format 2: DATE(MM/DD/RRRR)

How can I get the date format.

Thanks
basiranaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
srivenkyConnect With a Mentor Commented:
String format = ""; (Specify the format you want, check java api for all the formats)
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date d = new Date(rs.getString("YourDBDateDateField"));
String newDate = sdf.format(d);
0
 
basiranaAuthor Commented:
The problem is I am pulling Date (information from database. when I want to display I want to display in above formats
0
 
hoomanvCommented:
Use java.text.SimpleDateFormat
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
basiranaAuthor Commented:
Is there any difference in normat dateformate and when we use it with hibernate.
0
 
hoomanvCommented:
What was wrong with my answer ?
0
 
hoomanvCommented:
http://www.experts-exchange.com/help.jsp#hi68
In case of duplicate or similar comments, you should always select the first comment posted
0
All Courses

From novice to tech pro — start learning today.