jfun.util
Class DateUtil

java.lang.Object
  extended by jfun.util.DateUtil

public class DateUtil
extends java.lang.Object

Utility class to handle some date format logic.

Author:
Ben Yu

Constructor Summary
DateUtil()
           
 
Method Summary
static java.text.DateFormat getDateFormat(java.lang.String pattern, java.util.Locale locale)
          Create a DateFormat object by using a Locale and a pattern.
static java.text.DateFormat getDateFormat(java.lang.String pattern, java.util.Locale locale, java.util.TimeZone tzone)
          Create a DateFormat object by using a Locale, a TimeZone and a pattern.
static java.util.Locale parseLocale(java.lang.String str)
          To parse a string to Local object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

parseLocale

public static java.util.Locale parseLocale(java.lang.String str)
To parse a string to Local object.

Parameters:
str - the string.
Returns:
the Local object
Throws:
java.lang.IllegalArgumentException - if the string is not in the right format.

getDateFormat

public static java.text.DateFormat getDateFormat(java.lang.String pattern,
                                                 java.util.Locale locale)
Create a DateFormat object by using a Locale and a pattern.

Parameters:
pattern - the pattern.
locale - the Locale object.
Returns:
the DateFormat object.

getDateFormat

public static java.text.DateFormat getDateFormat(java.lang.String pattern,
                                                 java.util.Locale locale,
                                                 java.util.TimeZone tzone)
Create a DateFormat object by using a Locale, a TimeZone and a pattern.

Parameters:
pattern - the pattern.
locale - the Locale object.
tzone - the TimeZone object.
Returns:
the DateFormat object.