edu.nrao.sss.util
Class DateUtility

java.lang.Object
  extended by edu.nrao.sss.util.DateUtility

public class DateUtility
extends Object

A helper class for working with dates.

Version Info:

$Revision$
$Date$
$Author$ (last person to modify)

Since:
2007-09-19
Author:
David M. Harland

Constructor Summary
DateUtility()
           
 
Method Summary
static Date createEarlyDate()
          Creates and returns a very low, or early, date.
static Date createLateDate()
          Creates and returns a very high, or late, date.
static boolean earlyDateEquals(Date yourDate)
          Returns true if this utility's earlyDate is equal to yourDate.
static boolean lateDateEquals(Date yourDate)
          Returns true if this utility's earlyDate is equal to yourDate.
static DateFormat makeIso8601Formatter()
          Creates and returns a date formatter than parses dates from, and writes dates to, ISO 8601 text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtility

public DateUtility()
Method Detail

createEarlyDate

public static Date createEarlyDate()
Creates and returns a very low, or early, date.

This date is prior to any date that would reasonably be used in NRAO's SSS software. For the curious, this date is currently set to September 14, 1752, but no code should rely on this. (This is the first date that England and her colonies used the Gregorian Calendar.)


createLateDate

public static Date createLateDate()
Creates and returns a very high, or late, date.

This date is after any date that would reasonably be used in NRAO's SSS software. For the curious, this date is currently set to December 31, 9999, but no code should rely on this.


earlyDateEquals

public static boolean earlyDateEquals(Date yourDate)
Returns true if this utility's earlyDate is equal to yourDate.

Using this method is more efficient that calling DateUtility.createLateDate().equals(yourDate) because this method creates no new objects.

Parameters:
yourDate - the date to be tested.
Returns:
true if your date is the early date.

lateDateEquals

public static boolean lateDateEquals(Date yourDate)
Returns true if this utility's earlyDate is equal to yourDate.

Using this method is more efficient that calling DateUtility.createLateDate().equals(yourDate) because this method creates no new objects.

Parameters:
yourDate - the date to be tested.
Returns:
true if your date is the early date.

makeIso8601Formatter

public static DateFormat makeIso8601Formatter()
Creates and returns a date formatter than parses dates from, and writes dates to, ISO 8601 text.

Returns:
a date formatter built around the ISO 8601 specification.


Copyright © 2009. All Rights Reserved.