tags:

views:

23

answers:

1

Hi,

I'm a newbie so please help me in this. I have a datebox with a default date format and its working and displaying selected date in the box as expected.

Now, I need to get individual values from whats being displayed/selected, i.e., month, date, year. I need them to be used to query something in database.

Example : Displayed as July 14th, 2010. I require after displaying it in box, the numeric values as 7(for month), 14(for date), 2010(for the year).

Plese help, I'll be really thankful.

_ Chirayu Diwan

A: 

DateBox has a method getValue() which returns an obect of type java.util.Date. This class has individual method to get getYear(), getMonth() (offsets with 0, so 0 is January) and getDay().

Hilbrand
@Hibrand, Firstly thanks a lottt for answering..many times people don't reply because they find questions stupid..but I'm a newbie so need help.Now, I used what you recomended, and for 'July 14, 2010', I get 'getDay() : 3', 'getMonth() : 6' and 'getYear() : 110'. I may sound dumb, but tell me what to make of the day and year results ?!I'll really appreciate the help on this.
Chirayu
@Hibrand..got it, gotta use getDate() and for year, its gonna be 1900 + getYear(). Thank You so much.
Chirayu