com.nurelm.util
Class DateUtil

java.lang.Object
  extended bycom.nurelm.util.DateUtil

public class DateUtil
extends java.lang.Object

Perform date-specific functions, especially ones that are NuRelm app specific, such as NuContent's nu_today comparisons.


Field Summary
static java.lang.String[] DAYSINWEEK
           
static java.lang.String NU_TODAY
           
 
Constructor Summary
DateUtil()
           
 
Method Summary
static int compareDates(java.lang.String date1, java.lang.String date2)
          Compares input strings formated as dates (mm/dd/yyyy or mm/dd/yy) Returns 0 if dates are equal positive num if date1 > date2 negative num if date2 < date2 result of String.compareTo if inputs aren't dates Special input value of "NU_TODAY" represents today's date
static java.lang.String getDateString(java.util.Date date)
          Creates a date string suitable for storage in the DB in yyyy-mm-dd format.
static java.lang.String getDateString(int month, int day, int year)
          Creates a date string suitable for storage in the DB in yyyy-mm-dd format.
static int getDaysInMonth(int year, int month)
           
static int getFirstOfMonth(int year, int month)
           
static int getJanuaryFirst(int year)
           
static int getNumberRowsNeeded(int year, int month)
           
static java.util.Date getOffsetDate(java.lang.String dateString)
           
static java.lang.String getToday()
          Returns current date string in mm/dd/yyyy or mm/dd/yy format.
static boolean isDate(java.lang.String date)
          Checks if string is in mm/dd/yyyy or mm/dd/yy format.
static boolean isLeapYear(int year)
           
static java.lang.String shortDateToLong(java.lang.String content)
          Converts a date in yyyy-mm-dd format to a long date in Month dd, yyyy format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NU_TODAY

public static final java.lang.String NU_TODAY
See Also:
Constant Field Values

DAYSINWEEK

public static final java.lang.String[] DAYSINWEEK
Constructor Detail

DateUtil

public DateUtil()
Method Detail

getOffsetDate

public static java.util.Date getOffsetDate(java.lang.String dateString)

isDate

public static boolean isDate(java.lang.String date)
Checks if string is in mm/dd/yyyy or mm/dd/yy format.

Parameters:
date - The date to check.
Returns:
true if it is in the proper format.

getDateString

public static java.lang.String getDateString(int month,
                                             int day,
                                             int year)
Creates a date string suitable for storage in the DB in yyyy-mm-dd format.


getDateString

public static java.lang.String getDateString(java.util.Date date)
Creates a date string suitable for storage in the DB in yyyy-mm-dd format.


shortDateToLong

public static java.lang.String shortDateToLong(java.lang.String content)
Converts a date in yyyy-mm-dd format to a long date in Month dd, yyyy format.

Parameters:
content - Short date string to be converted
Returns:
Long date string in Month dd, yyyy format

getToday

public static java.lang.String getToday()
Returns current date string in mm/dd/yyyy or mm/dd/yy format.

Returns:
DOCUMENT ME!

compareDates

public static int compareDates(java.lang.String date1,
                               java.lang.String date2)
Compares input strings formated as dates (mm/dd/yyyy or mm/dd/yy) Returns 0 if dates are equal positive num if date1 > date2 negative num if date2 < date2 result of String.compareTo if inputs aren't dates Special input value of "NU_TODAY" represents today's date

Parameters:
date1 - DOCUMENT ME!
date2 - DOCUMENT ME!
Returns:
DOCUMENT ME!

getNumberRowsNeeded

public static int getNumberRowsNeeded(int year,
                                      int month)

getFirstOfMonth

public static int getFirstOfMonth(int year,
                                  int month)

getDaysInMonth

public static int getDaysInMonth(int year,
                                 int month)

isLeapYear

public static boolean isLeapYear(int year)

getJanuaryFirst

public static int getJanuaryFirst(int year)