Object CalendarUtils

  • All Implemented Interfaces:

    
    public class CalendarUtils
    
                        

    Utilities 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]]

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Date getCurrentDate(TimeZone timezone) Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
      final static Date getCurrentDate() Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
      final static String format(Date date, Boolean millis, TimeZone timezone) Format a date into yyyy-MM-ddThh:mm:ss.
      final static String format(Date date, Boolean millis) Format a date into yyyy-MM-ddThh:mm:ss.
      final static String format(Date date) Format a date into yyyy-MM-ddThh:mm:ss.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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].