net.livesite.util
Class DateStamp

java.lang.Object
  extended by java.util.Calendar
      extended by java.util.GregorianCalendar
          extended by net.livesite.util.DateStamp
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Calendar>

public class DateStamp
extends GregorianCalendar

Extension which assists with parsing common date formats.

Author:
Ryan Gies
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.GregorianCalendar
AD, BC
 
Fields inherited from class java.util.Calendar
AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
DateStamp()
          Current date.
DateStamp(Date date)
          Constructor.
DateStamp(int y, int m, int d)
          Constructor.
DateStamp(String date)
          Equal to given date string.
 
Method Summary
 boolean equals(Object other)
          Compare this to another.
 String format()
          Short formatted string.
 String format(String spec)
          Formatted string.
 Date toDate()
          Current moment as a date.
 String toString()
          Simple output.
 
Methods inherited from class java.util.GregorianCalendar
add, clone, computeFields, computeTime, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, hashCode, isLeapYear, roll, roll, setGregorianChange, setTimeZone
 
Methods inherited from class java.util.Calendar
after, before, clear, clear, compareTo, complete, get, getAvailableLocales, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateStamp

public DateStamp()
Current date.


DateStamp

public DateStamp(int y,
                 int m,
                 int d)
Constructor.

Parameters:
y - year
m - month
d - day of month

DateStamp

public DateStamp(Date date)
Constructor.

Parameters:
date - to represent

DateStamp

public DateStamp(String date)
          throws ParseException
Equal to given date string.

Throws:
ParseException
Method Detail

equals

public boolean equals(Object other)
Compare this to another.

Overrides:
equals in class GregorianCalendar

format

public String format()
Short formatted string.

Returns:
String
See Also:
format(String)

format

public String format(String spec)
Formatted string.

Parameters:
spec - like "MM/dd/yyyy"
Returns:
formatted string

toDate

public Date toDate()
Current moment as a date.

Returns:
as date object

toString

public String toString()
Simple output.

Overrides:
toString in class Calendar
Returns:
simple format for current locale