The DtpDate class compares time and date values, sets their formats, and returns components of a time and date value.
The static (class) methods operate on the class name. The static methods take a set of business objects and return the earliest or latest dates or the business objects that contain the earliest or latest dates.
Instance methods operate on a date object. You pass a date value to the DtpDate constructor and you can then manipulate the resulting date object. Instance methods let you retrieve, format, and change the values associated with the date. You can also set the formats in which you want to handle dates.
The data conversion methods are useful when one application stores dates in one format and another application stores dates in another format. For example, SAP might send a date in the format 26/8/1999 15:23:20 but Clarify might need the date in the format August 26, 1999 15:23:20.
The values passed to the
DtpDate class must follow these rules:
Day | A number from 1 to 30. If a separator between the month, year, and date is not present in the date-time string and the date is in a numeric format, single characters must be preceded by a zero (0), as in 01 |
Month | A number from 1 to 12, a name such as January or February, or an abbreviated (3 character) month name such as Jan or Feb. If a separator between the month, year, and date is not present in the date-time string and the date is in a numeric format, single characters must be preceded by a zero (0), as in 01. |
Year | A 4-digit number. |
Hour | A value in the range 01 to 23, representing 24-hour format. AM or PM designations are not allowed. |
Minutes | A number in the range 01 to 59. |
Seconds | A number in the range 01 to 59. |
Table 101 summarizes the methods in the DtpDate
class. Note that static and instance methods are separated in this
table but are in alphabetical order in the chapter.
Method | Description | Page |
---|---|---|
Constructor |
|
|
DtpDate() | Parse the date according to the format specified. | DtpDate() |
Static methods |
|
|
getMaxDate() | From a list of business objects, return the latest date as a DtpDate object. | getMaxDate() |
getMinDate() | From a list of business objects, return the earliest date as a DtpDate object. | getMinDate() |
getMaxDateBO() | From a list of business objects, return those that contain the latest date. | getMaxDateBO() |
getMinDateBO() | From a list of business objects, return those that contain the earliest date. | getMinDateBO() |
Instance methods |
|
|
addDays() | Add the specified number of days to this date. | addDays() |
addWeekdays() | Add the specified number of weekdays to this date. | addWeekdays() |
addYears() | Add the specified number of years to this date. | addYears() |
after() | Check whether this date follows the date passed in as the input parameter. | after() |
before() | Check whether this date precedes the date passed in as the parameter. | before() |
calcDays() | Calculate the number of days between this date and another date. | calcDays() |
calcWeekdays() | Calculate the number of weekdays between this date and another date. | calcWeekdays() |
get12MonthNames() | Return the current short-name representation of the twelve months for this date. | get12MonthNames() |
get12ShortMonthNames() | Return the current full-name representation of the twelve months for this date. | get12ShortMonthNames() |
get7DayNames() | Return the current names for the seven days in the week for this date. | get7DayNames() |
getCWDate() | Reformats this date into the IBM generic date format. | getCWDate() |
getDayOfMonth() | Return the day of the month for this date. | getDayOfMonth() |
getDayOfWeek() | Return the day of the week for this date. | getDayOfWeek() |
getHours() | Return the hours value for this date. | getHours() |
getIntDay() | Return the day of the week in this date as an integer. | getIntDay() |
getIntDayOfWeek() | Return the day of the week for this date. | getIntDayOfWeek() |
getIntMilliSeconds() | Return the milliSeconds value from this date. | getIntMilliSeconds() |
getIntMinutes() | Return the minutes value in this date as an integer. | getIntMinutes() |
getIntMonth() | Return the month in this date as an integer. | getIntMonth() |
getIntSeconds() | Return the seconds in this date as an integer. | getIntSeconds() |
getIntYear() | Return the year in this date as an integer. | getIntYear() |
getMSSince1970() | Return the number of milliseconds between January 1, 1970 00:00:00 and this date. | getMSSince1970() |
getMinutes() | Return the minutes value from this date. | getMinutes() |
getMonth() | Return the full name representation of the month in this date. | getMonth() |
getNumericMonth() | Return the month value from this date in numeric format. | getNumericMonth() |
getSeconds() | Return the seconds value from this date as a string. | getSeconds() |
getShortMonth() | Return the short name representation of the month name from this date. | getShortMonth() |
getYear() | Return the year value in this date. | getYear() |
set12MonthNames() | Change the full-name representation for the twelve month names for this date. | set12MonthNames() |
set12MonthNamesToDefault() | Restore the full-name representation for the twelve month names to the default values for this date. | set12MonthNamesToDefault() |
set12ShortMonthNames() | Change the short-name representation of the twelve month names for this date. | set12ShortMonthNames() |
set12ShortMonthNamesToDefault() | Restore the short-name representation of the twelve month names to the default values for this date. | set12ShortMonthNamesToDefault() |
set7DayNames() | Change the names of the seven days in the week for this date. | set7DayNames() |
set7DayNamesToDefault() | Restore the names of the seven days in the week to the default values for this date. | set7DayNamesToDefault() |
toString() | Return the date in a specified format or the default format. | toString() |