This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I am accessing an old database via SQL. The database stores dates in four different fields-Month, Day, Century, and Year- each are two digits. What is the best approach to use to convert these into a Date object? Also, I noticed that I am not getting the leading zeros either, so july would be a 7 instead of 07. Thanks in advance. [ October 25, 2002: Message edited by: Reed Peters ]
Calendar cal = Calendar.getInstance(). cal.set(Calendar.DATE, nDate); cal.set(Calendar.MONTH, nMonth); cal.set(Calendar.YEAR, nCentury + nYear); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); Does this help? Sorry it is a quick response. Forgive me if it doesnt work. There are several other approaches. [ October 25, 2002: Message edited by: Sankar Subbiah ]