com.cafesoft.core.util
Class DateUtils

java.lang.Object
  |
  +--com.cafesoft.core.util.DateUtils

public class DateUtils
extends Object

DateUtils is a class of methods for parsing, validating and otherwise working with dates.

Since:
July 12, 2001

Constructor Summary
DateUtils()
           
 
Method Summary
static String getLogFormattedDate()
          Helper method that returns a specific date format that is used for log files.
static String getLogFormattedDate(Date date)
          Helper method that returns a specific date format that is used for log files.
static String getLogFormattedDate(long date)
          Helper method that returns a specific date format that is used for log files.
static String getRFC1123FormattedDate(Date date)
          Helper method that returns an RFC 1123 formatted date.
static String isValidDate(String date, String format)
          Determine if a date is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtils

public DateUtils()
Method Detail

getLogFormattedDate

public static String getLogFormattedDate()
Helper method that returns a specific date format that is used for log files.

The date returned uses the following pattern:
dd/MMM/yyyy:HH:mm:ss ZZZ
For example, the date January 23, 2002 1:40:32 p.m. would be formatted and returned to look like 23/Jan/2002:13:40:32 -0700

Returns:
today's date in the format of dd/MMM/yyyy:HH:mm:ss ZZZ

getLogFormattedDate

public static String getLogFormattedDate(Date date)
Helper method that returns a specific date format that is used for log files.

The date returned uses the following pattern:
dd/MMM/yyyy:HH:mm:ss ZZZ
For example, the date January 23, 2002 1:40:32 p.m. would be formatted and returned to look like 23/Jan/2002:13:40:32 -0700

Parameters:
date - the date to be formatted
Returns:
today's date in the format of dd/MMM/yyyy:HH:mm:ss ZZZ

getLogFormattedDate

public static String getLogFormattedDate(long date)
Helper method that returns a specific date format that is used for log files.

The date returned uses the following pattern:
dd/MMM/yyyy:HH:mm:ss ZZZ
For example, the date January 23, 2002 1:40:32 p.m. would be formatted and returned to look like 23/Jan/2002:13:40:32 -0700

Parameters:
date - the date to be formatted (in milleseconds)
Returns:
today's date in the format of dd/MMM/yyyy:HH:mm:ss ZZZ

getRFC1123FormattedDate

public static String getRFC1123FormattedDate(Date date)
Helper method that returns an RFC 1123 formatted date.

The date returned uses the following pattern:
EEE, dd MMM yyyy HH:mm:ss zzz

Parameters:
date - the date to be formatted
Returns:
the date in the format of RFC 1123.

isValidDate

public static String isValidDate(String date,
                                 String format)
Determine if a date is valid.

Parameters:
date - The date to parse
format - The format of the date. Formats include:
  • mmddyyyy - Any combination of "/", "-", and " " must be used to separate the mm/dd/yyyy.
  • Returns:
    String "true" if date is valid, error message otherwise.


    Generated on 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.