|
Asterisk-Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.asteriskjava.util.DateUtil
public class DateUtil
Utility class to obtain the current date and allows to override with a fixed value for unit testing. Includes some convenience methods for date conversion.
Client code is not supposed to use this class.
| Method Summary | |
|---|---|
static java.util.Date |
getDate()
Returns the real current date or the date set with overrideCurrentDate(). |
static void |
overrideCurrentDate(java.util.Date currentDate)
If set to a non null value uses the date given as current date on calls to getDate(). |
static java.util.Date |
parseDateTime(java.lang.String s)
Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using the default time zone. |
static java.util.Date |
parseDateTime(java.lang.String s,
java.util.TimeZone tz)
Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using the given time zone. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void overrideCurrentDate(java.util.Date currentDate)
currentDate - the date to return on calls to getDate() or
null to return the real current date.public static java.util.Date getDate()
public static java.util.Date parseDateTime(java.lang.String s)
s - date string in the form of "yy-MM-dd HH:mm:ss"
null if it is not parsable.
public static java.util.Date parseDateTime(java.lang.String s,
java.util.TimeZone tz)
s - date string in the form of "yy-MM-dd HH:mm:ss"tz - the timezone to use or null for the default time zone.
null if it is not parsable.
|
Asterisk-Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||