org.brains2b.util
Class DateHelper

java.lang.Object
  extended byorg.brains2b.util.DateHelper

public class DateHelper
extends java.lang.Object

A function library giving some extra help dealing with dates.

Version:
0.13 [30-06-2007]
Author:
dennis@brains2b.nl

Constructor Summary
DateHelper()
           
 
Method Summary
static java.lang.String fromDate(java.util.Date dt)
          gets a date formatted as String with pattern "dd-MMM-yyyy"
static java.lang.String isoFromDate(java.util.Date d)
           
static java.lang.String isoFromDate(java.util.Date d, boolean includeTime)
           
static java.util.Date isoToDate(java.lang.String s)
           
static java.util.Date toDate(java.lang.String txt)
          returns a Date from a String representing a Date This toDate function is basically a rule based system recognizing a Date in the following patterns: a six digit String is interpreted as ddMMyy a String with a non character separator is interpreted as day-month-year day can be either 1 or 2 digits, with or without a leading 0 month can be either 1 or 2 digits, with or without a leading 0, a String representing the long name or a short name of the month.
static java.util.Date toDate(java.lang.String txt, java.util.Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateHelper

public DateHelper()
Method Detail

fromDate

public static final java.lang.String fromDate(java.util.Date dt)
gets a date formatted as String with pattern "dd-MMM-yyyy"

Parameters:
dt - java.util.Date
Returns:
String the formatted date, or null if Date was not given.

toDate

public static final java.util.Date toDate(java.lang.String txt)
                                   throws java.lang.NumberFormatException
returns a Date from a String representing a Date


toDate

public static final java.util.Date toDate(java.lang.String txt,
                                          java.util.Locale locale)
                                   throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

isoFromDate

public static final java.lang.String isoFromDate(java.util.Date d,
                                                 boolean includeTime)

isoFromDate

public static final java.lang.String isoFromDate(java.util.Date d)

isoToDate

public static final java.util.Date isoToDate(java.lang.String s)