com.billpringle.utils.wrputils
Class WrpDate

java.lang.Object
  extended by com.billpringle.utils.wrputils.WrpDate

public class WrpDate
extends java.lang.Object

Abstraction of a date object.

Creative Commons License Creative Commons License Symbols Unless noted otherwise, all materials available for download from my site are copyrighted by Bill Pringle, and are licensed under a Creative Commons License.

Author:
Bill Pringle

Field Summary
protected  int day
          day of month
protected  int month
          month of year
protected static java.lang.String[] months
          list of month abbreviations
protected  java.lang.String str
          string representation of date
protected  int year
          year value
 
Constructor Summary
WrpDate()
          Default constructor
WrpDate(java.lang.String s)
          Constructor with a date string
 
Method Summary
 int getDay()
          Get the day
 int getMonth()
          Get the month
 int getYear()
          Get the year
static java.lang.String monthAbbr(int MonthNumber)
          Get month abbreviation for month number
static int MonthNumber(java.lang.String MonthAbbr)
          Convert the name of the month to a number
private  void parseStr(java.lang.String s)
          Parse the input string and convert to a date
 void setDay(int day)
          Set the day
 void setMonth(int month)
          Set the month
 void setYear(int year)
          Set the year
 java.lang.String toString()
          Output date in string format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

months

protected static final java.lang.String[] months
list of month abbreviations


year

protected int year
year value


month

protected int month
month of year


day

protected int day
day of month


str

protected java.lang.String str
string representation of date

Constructor Detail

WrpDate

public WrpDate()
Default constructor


WrpDate

public WrpDate(java.lang.String s)
Constructor with a date string

Parameters:
s - date string (DD Mon YYYY)
Method Detail

monthAbbr

public static java.lang.String monthAbbr(int MonthNumber)
Get month abbreviation for month number

Parameters:
MonthNumber - month number (1-12)
Returns:
abbreviation for specified month

MonthNumber

public static int MonthNumber(java.lang.String MonthAbbr)
Convert the name of the month to a number

Parameters:
MonthAbbr - month name or abbreviation
Returns:
the number of the month

parseStr

private void parseStr(java.lang.String s)
Parse the input string and convert to a date

Parameters:
s - date string in format DD Mon YYYY

getYear

public int getYear()
Get the year

Returns:
the year

setYear

public void setYear(int year)
Set the year

Parameters:
year - the year to set

getMonth

public int getMonth()
Get the month

Returns:
the month

setMonth

public void setMonth(int month)
Set the month

Parameters:
month - the month to set

getDay

public int getDay()
Get the day

Returns:
the day

setDay

public void setDay(int day)
Set the day

Parameters:
day - the day to set

toString

public java.lang.String toString()
Output date in string format

Overrides:
toString in class java.lang.Object