com.ibm.mm.sdk.common
Class DKDate
- java.lang.Object
-
- java.util.Date
-
- java.sql.Date
-
- com.ibm.mm.sdk.common.DKDate
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>
public class DKDate extends java.sql.Date implements java.io.SerializableDKDate defines a generic date class to represent date data-type retrieved from back-end datastores. When represented as a string, the default format of DKDate is yyyy-mm-dd, as required by the majority of datastores.DKDDO supports DKDate objects; that is, it can send an attribute with DKDate type, in and out of a datastore.
- See Also:
Date,Date,DKDDO, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DKDate(java.sql.Date date)Constructs a DKDate from a given java.sql.Date object.DKDate(int year, int month, int day)Constructs a DKDate object from a given year, month, and day.DKDate(long date)Constructs a DKDate object from a long integer value representing the number of milliseconds since January 1, 1970, 00:00:00 GMT (Unix epoch time).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringtoString()Gets the string representation of this date object.static java.sql.DatevalueOf(java.lang.String s)Constructs a DKDate object using the string value of a given date in yyyy-mm-dd format.-
Methods inherited from class java.sql.Date
getHours, getMinutes, getSeconds, setHours, setMinutes, setSeconds, setTime, toInstant, toLocalDate, valueOf
-
-
-
-
Constructor Detail
-
DKDate
public DKDate(int year, int month, int day)Constructs a DKDate object from a given year, month, and day. This constructor validates that the year is an offset from 1900, month is between 0 and 11 (where 0 represents January), and day is between 1 and 31.- Parameters:
year- year is an integer offset from 1900month- month is a value between 0 and 11, where 0 represents Januaryday- day is day of the month, which is an integer between 1 and 31- Throws:
java.lang.IllegalArgumentException- if month is not between 0 and 11, or day is not between 1 and 31
-
DKDate
public DKDate(long date)
Constructs a DKDate object from a long integer value representing the number of milliseconds since January 1, 1970, 00:00:00 GMT (Unix epoch time). This constructor properly initializes the DKDate object by calling the superclass constructor Date(long date) from java.sql.Date.- Parameters:
date- a long integer representing the number of milliseconds since January 1, 1970, 00:00:00 GMT
-
DKDate
public DKDate(java.sql.Date date)
Constructs a DKDate from a given java.sql.Date object. This constructor creates a new DKDate instance with the same date value as the provided java.sql.Date object.- Parameters:
date- a java.sql.Date object
-
-
Method Detail
-
valueOf
public static java.sql.Date valueOf(java.lang.String s)
Constructs a DKDate object using the string value of a given date in yyyy-mm-dd format.- Parameters:
s- the date in string format- Returns:
- the date object
- Throws:
java.lang.IllegalArgumentException- if the string cannot be parsed as a valid date
-
toString
public java.lang.String toString()
Gets the string representation of this date object. The default format is yyyy-mm-dd, as required by the majority of datastores.- Overrides:
toStringin classjava.sql.Date- Returns:
- string representation of date in yyyy-mm-dd format
-
-