com.exponto.util
Class Date

java.lang.Object
  extended bycom.exponto.util.Date

public class Date
extends java.lang.Object

Stores the date (year, month, day) and also has various methodes for converting, finding working days and so one. Basicly written before I got some understanding of the various SDK calendar and date classes Konverterer en string p� formatet yyyymmdd til int year, month og day. yyyy m� v�re mellom 1700 og 2300, mm 1 til 12 og dd 1 til 31. Ingen sjekk p� dd sammen med mm Bruker av og til JDK's greogorianske kalender, der januar er 0, desember er 11. S�ndag er 1 og l�rdag er 7. Kunne v�rt noe bedre h�ndtering av feilformaterte strenger, eg brukt exceptions

Version:
0.5
Author:
kaare

Field Summary
 int day
           
 int dayInWeek
           
 int month
           
static java.lang.String[] monthsShort
          (English) Abbrivations for names of months
 int week
           
 int year
           
 
Constructor Summary
Date()
          Creates new date
Date(Date d, int weekOffset)
          Creates a new Date with value (d - number of weeks) A positive weekOffset gives an earlier date
Date(int y, int m, int d)
           
Date(java.lang.String s)
           
 
Method Summary
 void addDay()
           
 int check()
           
 int compareDate(Date d)
          Compare this day with another day (year, month and day) Returns 0 if both dates are the same -1/1 if year and month is equal, but date is different -2/2 if year is equal but month is different -4/4 if year is different 8 if total failure.
 int compareWeek(Date d)
           
 void convert(java.lang.String s)
           
 void findWeekDay()
           
static Date getNewDate(Date d, int field, int amount)
          Adds (or subtracts) an amount of time (days, months or year) to the date.
 Date klone()
           
 void setToNextWorkDay()
           
 void setToPreviousWorkDay()
          Sets this day to the previous working day (that is mon -fri).
 java.lang.String toDigitString()
          Returns the date as yyyymmdd
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

monthsShort

public static final java.lang.String[] monthsShort
(English) Abbrivations for names of months


year

public int year

month

public int month

day

public int day

week

public int week

dayInWeek

public int dayInWeek
Constructor Detail

Date

public Date()
Creates new date


Date

public Date(int y,
            int m,
            int d)

Date

public Date(java.lang.String s)

Date

public Date(Date d,
            int weekOffset)
Creates a new Date with value (d - number of weeks) A positive weekOffset gives an earlier date

Method Detail

convert

public void convert(java.lang.String s)

check

public int check()

findWeekDay

public void findWeekDay()

addDay

public void addDay()

setToNextWorkDay

public void setToNextWorkDay()

setToPreviousWorkDay

public void setToPreviousWorkDay()
Sets this day to the previous working day (that is mon -fri). Public holidays are ignored. The kalender part automatically handles change of month, year etc.


getNewDate

public static Date getNewDate(Date d,
                              int field,
                              int amount)
Adds (or subtracts) an amount of time (days, months or year) to the date.

Parameters:
d - Date
field - Which field to add
amount - The amount to de/increase the field
Returns:
new date

klone

public Date klone()

compareDate

public int compareDate(Date d)
Compare this day with another day (year, month and day) Returns 0 if both dates are the same -1/1 if year and month is equal, but date is different -2/2 if year is equal but month is different -4/4 if year is different 8 if total failure. Negative values indicates that this date the lesser of the two

Returns:
int result of comparison

compareWeek

public int compareWeek(Date d)

toString

public java.lang.String toString()

toDigitString

public java.lang.String toDigitString()
Returns the date as yyyymmdd

Returns:
the date as yyyymmdd


Copyright © 2004 Kaare Ranum