oracle.cle.util
Class SimpleDate

java.lang.Object
  |
  +--oracle.cle.util.SimpleDate
All Implemented Interfaces:
java.io.Serializable

public class SimpleDate
extends java.lang.Object
implements java.io.Serializable

Simple storage class that represents a point in time.
We should eventually add methods such as "minutesSince(aSimpleDate)", etc...

See Also:
Serialized Form

Field Summary
static int FORMAT_DMONY
           
static int FORMAT_HMS
           
static int FORMAT_MDY
           
static int FORMAT_MONDY
           
static int FORMAT_YMD
           
static int FORMAT_YMDHMS
           
 
Constructor Summary
SimpleDate()
           
SimpleDate(java.util.Date aDate)
           
SimpleDate(int aYear, int aMonth, int aDay)
           
SimpleDate(int aYear, int aMonth, int aDay, int anHour, int aMinute, int aSecond)
           
SimpleDate(SimpleDate aSimpleDate)
           
SimpleDate(java.lang.String aString, int aFormatOption)
           
 
Method Summary
static java.lang.String dateTimeStamp()
           
static java.util.Date getCurrentDate()
          Returns a new java.util.Date representing the current date and time
static java.sql.Date getCurrentSQLDate()
           
 int getDateDifference(int calUnit, SimpleDate toDate)
           
static int getDateDifference(int calUnit, SimpleDate fromDate, SimpleDate toDate)
          Gives the difference between the specifed dates in the unit specified by "calUnit".
 int getDay()
          Access method for the month attribute.
 int getHour()
          Access method for the hour attribute.
static int getLastDayOfMonth(int month, int year)
           
 int getMinute()
          Access method for the minute attribute.
 int getMonth()
          Access method for the month attribute.
 int getSecond()
          Access method for the second attribute.
 java.lang.String getStringMonth(int monthNo)
          This method returns the month name string for a given month number.
 java.lang.String getSubStringMonth(int monthNo)
          This method returns the month name sub string for a given month number.
 int getYear()
          Access method for the year attribute.
 boolean isAfter(SimpleDate aSimpleDate)
           
 boolean isBefore(SimpleDate aSimpleDate)
           
 boolean isSame(SimpleDate aSimpleDate)
           
 int julianDay()
          Returns an int containing the Julian Day.
static int julianDay(int aYear, int aMonth, int aDay)
          Returns an int containing the Julian Day.
static int[] julianToMonthDay(int year, int jday)
          Returns an array containing the month and day for the specified Julian Day (day of the year) and Year.
 boolean liesWithin(SimpleDate firstDate, SimpleDate secondDate)
           
static void main(java.lang.String[] args)
          A main to test functionality
 void setDay(int anInt)
          Sets the day attribute to the specified int.
 void setHour(int anInt)
          Sets the hour attribute to the specified int.
 void setMinute(int anInt)
          Sets the minute attribute to the specified int.
 void setMonth(int anInt)
          Sets the month attribute to the specified int.
 void setSecond(int anInt)
          Sets the second attribute to the specified int.
 void setYear(int anInt)
          Sets the year attribute to the specified int.
static java.lang.String timeStamp()
           
 java.util.Date toDate()
           
 java.sql.Date toSqlDate()
           
 java.lang.String toString(int aFormatOption)
           
 long totalSeconds()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_YMD

public static final int FORMAT_YMD

FORMAT_HMS

public static final int FORMAT_HMS

FORMAT_YMDHMS

public static final int FORMAT_YMDHMS

FORMAT_MDY

public static final int FORMAT_MDY

FORMAT_MONDY

public static final int FORMAT_MONDY

FORMAT_DMONY

public static final int FORMAT_DMONY
Constructor Detail

SimpleDate

public SimpleDate(int aYear,
                  int aMonth,
                  int aDay)

SimpleDate

public SimpleDate(int aYear,
                  int aMonth,
                  int aDay,
                  int anHour,
                  int aMinute,
                  int aSecond)

SimpleDate

public SimpleDate(SimpleDate aSimpleDate)

SimpleDate

public SimpleDate()

SimpleDate

public SimpleDate(java.util.Date aDate)

SimpleDate

public SimpleDate(java.lang.String aString,
                  int aFormatOption)
Method Detail

timeStamp

public static java.lang.String timeStamp()

dateTimeStamp

public static java.lang.String dateTimeStamp()

totalSeconds

public long totalSeconds()

isSame

public boolean isSame(SimpleDate aSimpleDate)

isBefore

public boolean isBefore(SimpleDate aSimpleDate)

isAfter

public boolean isAfter(SimpleDate aSimpleDate)

liesWithin

public boolean liesWithin(SimpleDate firstDate,
                          SimpleDate secondDate)

getYear

public int getYear()
Access method for the year attribute.
Returns:
The year attribute.

getMonth

public int getMonth()
Access method for the month attribute.
Returns:
The month attribute.

getDay

public int getDay()
Access method for the month attribute.
Returns:
The day attribute (as in '01' in 06/01/97).

getHour

public int getHour()
Access method for the hour attribute.
Returns:
The hour attribute.

getMinute

public int getMinute()
Access method for the minute attribute.
Returns:
The minute attribute.

getSecond

public int getSecond()
Access method for the second attribute.
Returns:
The second attribute.

setYear

public void setYear(int anInt)
Sets the year attribute to the specified int.
Parameters:
The - new year attribute.

setMonth

public void setMonth(int anInt)
Sets the month attribute to the specified int.
Parameters:
The - new month attribute.

setDay

public void setDay(int anInt)
Sets the day attribute to the specified int.
Parameters:
The - new day attribute.

setHour

public void setHour(int anInt)
Sets the hour attribute to the specified int.
Parameters:
The - new hour attribute.

setMinute

public void setMinute(int anInt)
Sets the minute attribute to the specified int.
Parameters:
The - new minute attribute.

setSecond

public void setSecond(int anInt)
Sets the second attribute to the specified int.
Parameters:
The - new second attribute.

getCurrentDate

public static java.util.Date getCurrentDate()
Returns a new java.util.Date representing the current date and time

julianToMonthDay

public static int[] julianToMonthDay(int year,
                                     int jday)
Returns an array containing the month and day for the specified Julian Day (day of the year) and Year.

julianDay

public static int julianDay(int aYear,
                            int aMonth,
                            int aDay)
Returns an int containing the Julian Day.

julianDay

public int julianDay()
Returns an int containing the Julian Day.

toString

public java.lang.String toString(int aFormatOption)

getStringMonth

public java.lang.String getStringMonth(int monthNo)
This method returns the month name string for a given month number. For example, input 1 will return January, 2 will return February

getSubStringMonth

public java.lang.String getSubStringMonth(int monthNo)
This method returns the month name sub string for a given month number. For example, input 1 will return Jan, 2 will return Feb,...

getLastDayOfMonth

public static int getLastDayOfMonth(int month,
                                    int year)

getDateDifference

public static int getDateDifference(int calUnit,
                                    SimpleDate fromDate,
                                    SimpleDate toDate)
                             throws java.lang.Exception
Gives the difference between the specifed dates in the unit specified by "calUnit". "calUnit" is defined in jdk's Calender class. e.g. value could be Calendar.WEEK_OF_YEAR.

getDateDifference

public int getDateDifference(int calUnit,
                             SimpleDate toDate)
                      throws java.lang.Exception

toDate

public java.util.Date toDate()

toSqlDate

public java.sql.Date toSqlDate()

getCurrentSQLDate

public static java.sql.Date getCurrentSQLDate()

main

public static void main(java.lang.String[] args)
A main to test functionality


Copyright © 2003 ORACLE Corp. All Rights Reserved.