|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Calendar
java.util.GregorianCalendar
uk.co.weft.dbutil.Calendar
A specialisation of a GregorianCalendar which doesn't make a complete balls-up of rendering itself as a string. I have commented elsewhere on the wanton overcomplication of the Java date handling code... I hope the person who designed it is for ever after forced to keep his diary using the output from GregorianCalendar.toString() as his date format. This class is made slightly more complicated by the need to guess whether a given Calendar represents a date, or a time, or a timestamp. The dancing around with MAXDATESECOND and MAXTIMEYEAR is intended to disambiguate these, but means that Jaquard applications can't reliably deal with instances happening within a few seconds of midnight on years prior to MAXTIMEYEAR. The fundamental problem is that Microsoft SQL Server has no DATE or TIME datatype but only a DATETIME, which it reports to JDBC as a TIMESTAMP (which, of course, it isn't). So we need to decide whether what we're dealing with is really just a date, or, alternatively, really just a time, or both. Unfortunately even if it is really just a date, it will typically be a few milliseconds old by the time we see it. Similarly, a value which is really just a time gets a year value which is typically not zero (but I differs from database engine to database engine). Consequently, I will treat any Calendar object having a time less than Calendar.MAXDATESECONDS past midnight as just being a date, and any Calendar having a year earlier than Calendar.MINTIMEYEAR as just being a time.
| Field Summary | |
static int |
MAXDATESECONDS
The maximum number of seconds after midnight which we will ignore in considering a Calendar object to represent 'just' a date |
static int |
MAXTIMEYEAR
The maximum year value we will accept in considering a Calendar to represent 'just' a time |
| Fields inherited from class java.util.GregorianCalendar |
AD, BC |
| Fields inherited from class java.util.Calendar |
AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET |
| Constructor Summary | |
Calendar()
|
|
| Method Summary | |
java.lang.String |
toSQLDateString()
|
java.lang.String |
toSQLTimeStampString()
|
java.lang.String |
toString()
Return a sensible, human readable string representing the date/time represented by this Calendar |
| Methods inherited from class java.util.GregorianCalendar |
add, computeFields, computeTime, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, hashCode, isLeapYear, roll, roll, setGregorianChange |
| Methods inherited from class java.util.Calendar |
after, before, clear, clear, clone, complete, get, getAvailableLocales, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MAXDATESECONDS
public static final int MAXTIMEYEAR
| Constructor Detail |
public Calendar()
| Method Detail |
public java.lang.String toSQLDateString()
public java.lang.String toSQLTimeStampString()
public java.lang.String toString()
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||