public class DateUtil extends Object
Client code is not supposed to use this class.
Modifier and Type | Method and Description |
---|---|
static Date |
getDate()
Returns the real current date or the date set with overrideCurrentDate().
|
static void |
overrideCurrentDate(Date currentDate)
If set to a non null value uses the date given as current date on calls
to getDate().
|
static Date |
parseDateTime(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 Date |
parseDateTime(String s,
TimeZone tz)
Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using
the given time zone.
|
public static void overrideCurrentDate(Date currentDate)
currentDate
- the date to return on calls to getDate() or
null
to return the real current date.public static Date getDate()
public static Date parseDateTime(String s)
s
- date string in the form of "yy-MM-dd HH:mm:ss"null
if it is not parsable.public static Date parseDateTime(String s, 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.Copyright © 2004–2016. All rights reserved.