Java Glossary : Date

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : D words : Date.

Date
Java has no standard classes for handling pure dates without times. It does have the following classes: These are among the worst bits of code ever written. You can do quite a bit with

// get time in milliseconds since 1970 Jan 1
long timestamp = System.currentTimeMillis();

If you you use pure longs, you don't have to deal with timezones, leap years, months with variable number of days, regional differences, bulky objects, slow code and all the gotchas in the Date and Calendar classes. SQL can't screw up a long. It surely can a SQLDate. Think hard to keep the bulk of your application dealing with simple longs. Only use Date, Calendar or CalendarFormat when you need to input or output human-readable dates/times.

There are a ton of surprises and bugs awaiting the unwary users of these classes.

BigDate for handling pure dates without times ¤ essay on Dates and Calendars ¤ gotchas for the details ¤ time


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 2768.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/date.html J:\mindprod\jgloss\date.html