org.slim3.commons.util
Class DateUtil

java.lang.Object
  extended by org.slim3.commons.util.DateUtil

public final class DateUtil
extends Object

A utility class for Date.

Version:
3.0
Author:
higa

Method Summary
static String getPattern(Locale locale)
          Returns the pattern for the locale.
static Date toDate(Object o)
          Converts the object to Date.
protected static Date toDate(String text, Locale locale)
          Converts the text to Date.
static Date toDate(String text, String pattern)
          Converts the text to Date.
static String toString(Date value, String pattern)
          Converts the Date value to text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toDate

public static Date toDate(Object o)
Converts the object to Date.

Parameters:
o - the object
Returns:
the converted value

toDate

public static Date toDate(String text,
                          String pattern)
                   throws NullPointerException,
                          ParseRuntimeException
Converts the text to Date.

Parameters:
text - the text
pattern - the pattern for SimpleDateFormat
Returns:
the converted value
Throws:
NullPointerException - if the pattern parameter is null
ParseRuntimeException - if ParseException is encountered

toString

public static String toString(Date value,
                              String pattern)
Converts the Date value to text.

Parameters:
value - the Date value
pattern - the pattern for SimpleDateFormat
Returns:
the converted value

toDate

protected static Date toDate(String text,
                             Locale locale)
                      throws ParseRuntimeException
Converts the text to Date.

Parameters:
text - the text
locale - the locale
Returns:
the converted value
Throws:
ParseRuntimeException - if ParseException is encountered

getPattern

public static String getPattern(Locale locale)
Returns the pattern for the locale.

Parameters:
locale - the locale
Returns:
the pattern


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.