getDate() is deprecated.

long lng = objTimestamp .getTime()
Date date = new Date(lng);
                Calendar cal = Calendar.getInstance();
                cal.clear();
                cal.setTime(date);
                int yy = cal.get(Calendar.YEAR);
                if (yy < 100)
                        yy += 1900;
                int month = objCalendar.get(Calendar.MONTH)+1;
                int date = objCalendar.get(Calendar.DATE);
                int hour = objCalendar.get(Calendar.HOUR_OF_DAY);
                int minute = objCalendar.get(Calendar.MINUTE);

Regards

Ramesh Kesavanarayanan
Electronic Data Systems
7th Floor, Tidel Park

*      91-44-254 9650 ext :2442
          91-44-226 5360 (res)
* [EMAIL PROTECTED]
* [EMAIL PROTECTED]
Don't be too good I will miss you.Don't be too caring, I might like you.
Don't be too sweet, I might fall



-----Original Message-----
From: Bhushan_Bhangale [mailto:[EMAIL PROTECTED]]
Sent: Monday, 27 May 2002 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: Date and time parser


Try like this:-

Timestamp objTimestamp = getTimestamp("date_time")
Calendar objCalendar = Calendar.getInstance();
objCalendar.setTime(objTimestamp.getDate());
int year = objCalendar.get(Calendar.YEAR);
int month = objCalendar.get(Calendar.MONTH);
int date = objCalendar.get(Calendar.DATE);
int hour = objCalendar.get(Calendar.HOUR_OF_DAY);
int minute = objCalendar.get(Calendar.MINUTE);

and so on you check the API of Calendar class.

-----Original Message-----
From: Gading [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 27, 2002 1:07 PM
To: [EMAIL PROTECTED]
Subject: Date and time parser


Hi,
I have a timestamp object, obtain from DB using getTimestamp("date_time").
output is something like "2002-05-27 14:17:00".
How to get year, month, date, hour and minute in string (or int is also ok)?

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

==========================================================================To
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to