I presume you fetch some records with an SQL statement into a ResultSet object. Then you fetch data on a row by row basis, geting Date with getDate function. Date has hours and minutes, you can manualy reset them to 00:00. If you only need a formated String to print out somewhere, use SimpleDateFormat
I need to convert new date() object to Date object.(yyyy-MM-dd).
can you tell me how to do that.
First i convert the Date object to String ("yyyy-MM-dd")
But how to parse it to Date.
i hv got a piece of code.
Joined: Sep 16, 2008
Raza Mohd, you can't format the Date object. You can only get a formatted string object, using a formatter and a date object. (unless you want to extend Date and override its toString method ... don't do it )
here's what I think you want:
Why would you use this? If you need to query for todays dates there is a current time function in mySQL CURDATE() and for current time there is CURTIME()