Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help: Setting java.sql.date Object

Status
Not open for further replies.
Jan 8, 2001
163
US
Hello all! I have a java.sql.date object called startdate that I need to initialize and set. Initializing it is easy enough

java.sql.Date startdate;


But how do I set startdate to say, January 1, 2005?
Does anyone have an example of this?

Thanks in advance,
CrystalVisualBOracle :)
 
Code:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy");
java.sql.Date startDate = new java.sql.Date(sdf.parse("01/Jan/2005").getTime());
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top