|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.util.DateUtil
public class DateUtil
Util to format and parse dates.
Field Summary | |
---|---|
static String |
FORMAT_DATE_LONG
|
static String |
FORMAT_DATE_MEDIUM
|
static String |
FORMAT_DATE_SHORT
|
static String |
FORMAT_DATETIME_LONG
|
static String |
FORMAT_DATETIME_MEDIUM
|
static String |
FORMAT_DATETIME_SHORT
|
static String |
FORMAT_DEFAULTPATTERN
Default date format. |
static String |
FORMAT_TIME_LONG
|
static String |
FORMAT_TIME_MEDIUM
|
static String |
FORMAT_TIME_SHORT
|
static TimeZone |
UTC_TIME_ZONE
|
static String |
YYYY_MM_DD
|
static String |
YYYY_MM_DD_T_HH_MM_SS
|
Method Summary | |
---|---|
static String |
createDateExpression(Calendar calendar)
Expression for searching - representing a date. |
static String |
createDateTimeExpression(Calendar calendar)
Expression for searching - representing a date and time. |
static String |
createDateTimeExpressionIgnoreTimeZone(Calendar calendar)
Expression for searching - not considering the timezone. |
static String |
format(Date date,
String formatPattern)
Supports implicit formats like: date, date long, datetime, dateime long, time and time long. |
static String |
format(Date date,
String formatPattern,
Locale locale)
|
static String |
formatDate(Object val)
Uses the current locale (user) to format the date. |
static String |
formatDateTime(Object val)
Uses the current locale (user) to format the date and time. |
static Calendar |
getCurrentUTCCalendar()
Get UTC Calendar for current time. |
static Calendar |
getLocalCalendarFromUTC(Calendar utc)
Get the equivalent UTC calendar to a local calendar. |
static Calendar |
getUTCCalendarFromDialogString(String dateString)
Convert a string date from a dialog date to a UTC calendar ready to be stored in the repository. |
static Calendar |
getUTCCalendarFromLocalDate(Date date)
Convert a local date time to a UTC calendar. |
static Date |
parseDate(String dateStr)
Uses the current locale (user) to parse the date. |
static Date |
parseDateTime(String dateStr)
Uses the current locale (user) to parse the date and time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FORMAT_DATE_SHORT
public static final String FORMAT_DATE_MEDIUM
public static final String FORMAT_DATE_LONG
public static final String FORMAT_DATETIME_SHORT
public static final String FORMAT_DATETIME_MEDIUM
public static final String FORMAT_DATETIME_LONG
public static final String FORMAT_TIME_SHORT
public static final String FORMAT_TIME_MEDIUM
public static final String FORMAT_TIME_LONG
public static final String FORMAT_DEFAULTPATTERN
public static final String YYYY_MM_DD
public static final String YYYY_MM_DD_T_HH_MM_SS
public static final TimeZone UTC_TIME_ZONE
Method Detail |
---|
public static String format(Date date, String formatPattern)
public static String format(Date date, String formatPattern, Locale locale)
public static String formatDateTime(Object val)
val
- Date or Calendar
public static String formatDate(Object val)
val
- Date or Calendar
public static Date parseDateTime(String dateStr) throws ParseException
val
- Date or Calendar
ParseException
public static Date parseDate(String dateStr) throws ParseException
val
- Date or Calendar
ParseException
public static Calendar getLocalCalendarFromUTC(Calendar utc)
public static Calendar getUTCCalendarFromDialogString(String dateString) throws ParseException
ParseException
public static Calendar getUTCCalendarFromLocalDate(Date date)
public static Calendar getCurrentUTCCalendar()
public static String createDateExpression(Calendar calendar)
public static String createDateTimeExpression(Calendar calendar)
public static String createDateTimeExpressionIgnoreTimeZone(Calendar calendar)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |