com.adhi.adhij
Class DateUtil

java.lang.Object
  extended by com.adhi.adhij.DateUtil

public class DateUtil
extends java.lang.Object

The Date utility class

Author:
DKRISHNA

Constructor Summary
DateUtil()
           
 
Method Summary
static java.lang.String dateTimeToString(java.util.Date date)
          converts a date to a string
static java.lang.String dateToString(java.util.Date date)
          converts the date to a string
static java.lang.String dateToString(java.util.Date date, java.lang.String pattern)
          convert the string to a date using a format
static java.lang.String dateToStringMMM(java.util.Date date)
          converts the date to a string
static java.util.Date stringMMMToDate(java.lang.String dateStr)
          converts the string to a date
static java.util.Date stringToDate(java.lang.String dateStr)
          converts the string to a date
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

stringToDate

public static java.util.Date stringToDate(java.lang.String dateStr)
                                   throws java.text.ParseException
converts the string to a date

Parameters:
dateStr - the date string to be converted
Returns:
the converted date
Throws:
java.text.ParseException - if the string cannot be parsed

dateToString

public static java.lang.String dateToString(java.util.Date date)
converts the date to a string

Parameters:
date - the date to be converted
Returns:
the converted string of the format yyyy-MM-dd

dateToStringMMM

public static java.lang.String dateToStringMMM(java.util.Date date)
converts the date to a string

Parameters:
date - the date to be converted
Returns:
the converted string of the format yyyy-MM-dd

dateTimeToString

public static java.lang.String dateTimeToString(java.util.Date date)
converts a date to a string

Parameters:
date - the date to be converted
Returns:
the converted string of the format yyyy-MM-dd HH:mm:ss

dateToString

public static java.lang.String dateToString(java.util.Date date,
                                            java.lang.String pattern)
convert the string to a date using a format

Parameters:
date - the date
pattern - the format pattern
Returns:
the converted date using the pattern

stringMMMToDate

public static java.util.Date stringMMMToDate(java.lang.String dateStr)
                                      throws java.text.ParseException
converts the string to a date

Parameters:
dateStr - the date string
Returns:
the converted date using the format dd-MMM-yyyy
Throws:
java.text.ParseException - if the string cannot be parsed