Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

AS400 Hundred Year Format toHundredYear()

800449Jul 23 2007 — edited Jul 23 2007
If you want to query a record by date on the AS400 DB2, you have to convert a java date to Hundred Year Format. VB has a utility that creates a very close value built in, but I could not find anything for java. Here's my code for future java programmers!

-Tres
public static int toHundredYear(Date d) {
		Calendar c = Calendar.getInstance();
		c.setTime(d);
		return (int)(c.getTimeInMillis()/86400000.0) + 25568;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2007
Added on Jul 23 2007
0 comments
170 views