net.sourceforge.jpalm.mobiledb.field.type
Class Date

java.lang.Object
  extended by net.sourceforge.jpalm.mobiledb.field.type.Date
All Implemented Interfaces:
Type<java.util.Date>

public class Date
extends java.lang.Object
implements Type<java.util.Date>

A date in a MobileDB record.

A date is stored as the number of days since the Palm epoch (January 1, 1904 00:00 GMT). When displaying the date returned by getValue(), the time part should be ignored and the GMT timezone should be used.

Example:

 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
 System.out.println(dateFormat.format(new Date().getValue()));
 


Field Summary
protected  T value
           
 
Constructor Summary
Date()
          Creates a new date representing the current date.
Date(java.util.Date date)
          Creates a new date representing the specified date.
 
Method Summary
 boolean equals(java.lang.Object object)
           
static Date fromMobileDB(java.lang.String string)
          Creates a date from the MobileDB value.
 java.util.Date getValue()
          Gets the native object for this type.
 java.lang.String toMobileDB()
          Gets the MobileDB value for this type.
 java.lang.String toString()
          Gets a string representation of this date in yyyy-MM-dd format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected T value
Constructor Detail

Date

public Date(java.util.Date date)
Creates a new date representing the specified date.

Parameters:
date - the date

Date

public Date()
Creates a new date representing the current date.

Method Detail

toMobileDB

public java.lang.String toMobileDB()
Description copied from interface: Type
Gets the MobileDB value for this type.

Specified by:
toMobileDB in interface Type<java.util.Date>
Returns:
the MobileDB value

fromMobileDB

public static Date fromMobileDB(java.lang.String string)
Creates a date from the MobileDB value.

Parameters:
string - the MobileDB value to convert
Returns:
a date

toString

public java.lang.String toString()
Gets a string representation of this date in yyyy-MM-dd format.

Returns:
the string representation of this date

getValue

public java.util.Date getValue()
Description copied from interface: Type
Gets the native object for this type.

Specified by:
getValue in interface Type<java.util.Date>
Returns:
the native object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object