|
2.9.0: 2008-11-26 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.DateUtil
public class DateUtil
Utility methods that will make it easier to handle date values. Especially, dates must be cloned whenver they are returned to or passed from client applications.
Field Summary | |
---|---|
private static SimpleDateFormat |
DATE_FORMAT
|
Constructor Summary | |
---|---|
DateUtil()
|
Method Summary | |
---|---|
static Date |
copy(Date value)
Get a copy of the date. |
static String |
formatDate(Date d)
Formats a date in yyyy-MM-dd format. |
static Date |
parseString(String value)
Parses a string to create a Date . |
static Date |
setNotNullDate(Date value,
String name)
Make a copy of a Date object. |
static Date |
setNullableDate(Date value,
String name)
Make a copy of a Date object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final SimpleDateFormat DATE_FORMAT
Constructor Detail |
---|
public DateUtil()
Method Detail |
---|
public static Date setNullableDate(Date value, String name)
Date
object. Null values are allowed.
value
- The date to checkname
- The name of the attribute to use if an exception is thrown
public static Date setNotNullDate(Date value, String name) throws InvalidUseOfNullException
Date
object. Null values are not allowed.
value
- The date to check. Can not be null.name
- The name of the attribute to use if an exception is thrown
InvalidUseOfNullException
- If the value parameter is null.public static Date copy(Date value)
value
- Date value to copy
public static Date parseString(String value) throws InvalidDataException
Date
. This method supports
date in yyyy-MM-dd format or as long timevalues.
value
- the String
to be parsed
Date
object
InvalidDataException
- if value
isn't a valid date.public static String formatDate(Date d)
d
- The date to format.
|
2.9.0: 2008-11-26 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |