jodd.datetime
Class DateTimeStamp

java.lang.Object
  extended by jodd.datetime.DateTimeStamp
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class DateTimeStamp
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable, java.lang.Cloneable

Generic date time stamp just stores and holds date and time information. This class does not contain any date/time logic, neither guarantees that date is valid.

See Also:
JDateTime, JulianDateStamp, Serialized Form

Field Summary
 int day
          Day, range: [1 - 31]
 int hour
          Hour, range: [0 - 23]
 int millisecond
          Millisecond, range: [0 - 1000]
 int minute
          Minute, range [0 - 59]
 int month
          Month, range: [1 - 12]
 int second
          Second, range: [0 - 59]
 int year
          Year.
 
Constructor Summary
DateTimeStamp()
          Default empty constructor.
DateTimeStamp(int year, int month, int day)
          Constructor that sets just date.
DateTimeStamp(int year, int month, int day, int hour, int minute, int second, int millisecond)
          Constructor that sets date and time.
 
Method Summary
protected  DateTimeStamp clone()
           
 int compareDateTo(java.lang.Object o)
          Compares just date component of two date time stamps.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object object)
           
 int getDay()
           
 int getHour()
           
 int getMillisecond()
           
 int getMinute()
           
 int getMonth()
           
 int getSecond()
           
 int getYear()
           
 int hashCode()
           
 boolean isEqualDate(DateTimeStamp date)
           
 boolean isEqualTime(DateTimeStamp time)
           
 void setDay(int day)
           
 void setHour(int hour)
           
 void setMillisecond(int millisecond)
           
 void setMinute(int minute)
           
 void setMonth(int month)
           
 void setSecond(int second)
           
 void setYear(int year)
           
 java.lang.String toString()
          Simple to string conversion.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

year

public int year
Year.


month

public int month
Month, range: [1 - 12]


day

public int day
Day, range: [1 - 31]


hour

public int hour
Hour, range: [0 - 23]


minute

public int minute
Minute, range [0 - 59]


second

public int second
Second, range: [0 - 59]


millisecond

public int millisecond
Millisecond, range: [0 - 1000]

Constructor Detail

DateTimeStamp

public DateTimeStamp()
Default empty constructor.


DateTimeStamp

public DateTimeStamp(int year,
                     int month,
                     int day,
                     int hour,
                     int minute,
                     int second,
                     int millisecond)
Constructor that sets date and time.


DateTimeStamp

public DateTimeStamp(int year,
                     int month,
                     int day)
Constructor that sets just date. Time is set to zeros.

Method Detail

getYear

public int getYear()

setYear

public void setYear(int year)

getMonth

public int getMonth()

setMonth

public void setMonth(int month)

getDay

public int getDay()

setDay

public void setDay(int day)

getHour

public int getHour()

setHour

public void setHour(int hour)

getMinute

public int getMinute()

setMinute

public void setMinute(int minute)

getSecond

public int getSecond()

setSecond

public void setSecond(int second)

getMillisecond

public int getMillisecond()

setMillisecond

public void setMillisecond(int millisecond)

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

compareDateTo

public int compareDateTo(java.lang.Object o)
Compares just date component of two date time stamps.


toString

public java.lang.String toString()
Simple to string conversion.

Overrides:
toString in class java.lang.Object
Returns:
date/time string in 'y-m-d h:m:m.s' format

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

protected DateTimeStamp clone()
Overrides:
clone in class java.lang.Object

isEqualDate

public boolean isEqualDate(DateTimeStamp date)

isEqualTime

public boolean isEqualTime(DateTimeStamp time)


Copyright © 2003-2012 Jodd Team