1

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

Chirayu
  • 613
  • 1
  • 6
  • 18
  • 1
    You might want to check this [related question](http://stackoverflow.com/questions/3201762/get-date-details-day-month-year-in-gwt) about handling Dates in GWT. – Jla Jul 15 '10 at 07:32

1 Answers1

2

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 Bouwkamp
  • 13,509
  • 1
  • 45
  • 52
  • @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 Jul 14 '10 at 17:30
  • @Hibrand..got it, gotta use getDate() and for year, its gonna be 1900 + getYear(). Thank You so much. – Chirayu Jul 14 '10 at 17:46