|
this will only return u the current date/Time not
any date..
u need to use DateFormat to parse the String date
into a
date object and then using one of
SimpleDateFormat's
methods to format it the way u want.
Alternatively u can
use getMonth() of Date class which will
return an int (0-11)
which can be made to reference an array of your
months.
But the best i suggest is to get all this
information from
the database itself by using tochar function
on the date
data type.
regards,
anoop
----- Original Message -----
Sent: Wednesday, October 24, 2001 11:18
AM
Subject: Re: how to get Date,Month...
from date
Hi Shashi,
You can use the java.util.Calendar, first you
create an instance of Date then pass it to the Calendar setTime method,
after that you can get the day, month or year. Here is the sample
code:
Date date = new Date(); Calendar cal =
Calendar.getInstance(); cal.setTime(date);
int year =
cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day =
cal.get(Calendar.DAY_OF_MONTH);
Regards, Wayan
-----Original
Message----- From: shashi kanth goud
[mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 1:27
PM To: [EMAIL PROTECTED] Subject:
Re: how to get Date,Month... from date
hai
all, How to get month,date and year
from Date object. I have found that getDate()..... of Date object are
deprecated .Is there any other way to get above things. I will get date
from my database thanx in
adv Shashi
___________________________________________________________________________ To
unsubscribe, send email to [EMAIL PROTECTED] and include in
the body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources:
http://java.sun.com/products/servlet/external-resources.html LISTSERV
Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________ To
unsubscribe, send email to [EMAIL PROTECTED] and include in
the body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources:
http://java.sun.com/products/servlet/external-resources.html LISTSERV
Help: http://www.lsoft.com/manuals/user/user.html
|