Click to See Complete Forum and Search --> : How to use date in java?


hrin
03-24-2005, 09:33 PM
Hi,

If I want a user to input a date alone, not with time, how can I do it? Eg. A customer calls to make a reservation at a restaurant, the user has to key in a date that the customer wants to reserve the place for.

I can't use int cos validating data will be very troublesome right? Is it possible to show me an example? Furthermore, I need to store the date attribute in an object reservation and to later on implement a search function based on the date.

Would really appreciate an example. Thanks so much..

sjalle
03-24-2005, 09:37 PM
Use the Calendar class for reading and set the allowed formats for the textfield that receives the date. Then store the date in a java.sql.Date object
for use in databases.