Object CalendarUtils
-
- All Implemented Interfaces:
public class CalendarUtilsUtilities methods for manipulating dates in iso8601 format. This is much much faster and GC friendly than using SimpleDateFormat so highly suitable if you (un)serialize lots of date objects.
Supported parse format: yyyy-MM-dd|yyyyMMdd[T(hh:mm[:ss.sss]|hhmm[ss.sss])]?[Z|+-hh:mm]]
-
-
Field Summary
Fields Modifier and Type Field Description public final static CalendarUtilsINSTANCE
-
Method Summary
Modifier and Type Method Description final static DategetCurrentDate(TimeZone timezone)Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch"). final static DategetCurrentDate()Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch"). final static Stringformat(Date date, Boolean millis, TimeZone timezone)Format a date into yyyy-MM-ddThh:mm:ss. final static Stringformat(Date date, Boolean millis)Format a date into yyyy-MM-ddThh:mm:ss. final static Stringformat(Date date)Format a date into yyyy-MM-ddThh:mm:ss. -
-
Method Detail
-
getCurrentDate
@JvmOverloads() final static Date getCurrentDate(TimeZone timezone)
Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
- Parameters:
timezone- the timezone to use.- Returns:
a Date representing the time value.
-
getCurrentDate
@JvmOverloads() final static Date getCurrentDate()
Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
- Returns:
a Date representing the time value.
-
format
@JvmOverloads() final static String format(Date date, Boolean millis, TimeZone timezone)
Format a date into yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm]
- Parameters:
date- the date to format.millis- true to include millis precision otherwise false.timezone- the timezone to use for formatting.- Returns:
the date formatted as yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm].
-
format
@JvmOverloads() final static String format(Date date, Boolean millis)
Format a date into yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm]
- Parameters:
date- the date to format.millis- true to include millis precision otherwise false.- Returns:
the date formatted as yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm].
-
format
@JvmOverloads() final static String format(Date date)
Format a date into yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm]
- Parameters:
date- the date to format.- Returns:
the date formatted as yyyy-MM-ddThh:mm:ss.sss[Z|+-hh:mm].
-
-
-
-