What you have made is not efficient as it is parsing the Date object as many times you want some date field value. Also making a number of objects. Instead use the Calendar solution which is parsing only once and then using the Calendar class returning the required values.
-----Original Message----- From: Gading [mailto:[EMAIL PROTECTED]] Sent: Monday, May 27, 2002 5:53 PM To: [EMAIL PROTECTED] Subject: Re: Date and time parser At 05:21 PM 5/27/2002 +0530, you wrote: >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. Thanks. I've found another way to get this, didn't know which is "better". SimpleDateFormat y = new SimpleDateFormat("yyyy"); SimpleDateFormat m = new SimpleDateFormat("M"); SimpleDateFormat d = new SimpleDateFormat("d"); int year= 0, mon = 0, day= 0; try { Date theDate= auc.getDateCol("dlv_date_1"); year= Integer.parseInt(y.format(theDate)); mon= Integer.parseInt(m.format(theDate)); day= Integer.parseInt(d.format(theDate)); } catch (Exception ignore){ } =========================================================================== 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