Class CmsDateTimeUtil


  • public final class CmsDateTimeUtil
    extends java.lang.Object
    Client side implementation for CmsDateUtil.

    Since:
    8.0.0
    See Also:
    CmsDateUtil
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CmsDateTimeUtil.Format
      The standard formats.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getDate​(java.util.Date date, CmsDateTimeUtil.Format format)
      Returns a formated date String from a Date value, the formatting based on the provided options.
      static java.lang.String getDateShort​(long time)
      Returns a formated date String form a timestamp value, the formatting based on the OpenCms system default locale and the CmsDateTimeUtil.Format.SHORT date format.
      static java.lang.String getDateTime​(java.util.Date date, CmsDateTimeUtil.Format format)
      Returns a formated date and time String from a Date value, the formatting based on the provided options.
      static java.lang.String getDateTimeShort​(long time)
      Returns a formated date and time String form a timestamp value, the formatting based on the OpenCms system default locale and the CmsDateTimeUtil.Format.SHORT date format.
      static java.lang.String getTime​(java.util.Date date, CmsDateTimeUtil.Format format)
      Returns a formated time String from a Date value, the formatting based on the provided options.
      • Methods inherited from class java.lang.Object

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

      • getDate

        public static java.lang.String getDate​(java.util.Date date,
                                               CmsDateTimeUtil.Format format)
        Returns a formated date String from a Date value, the formatting based on the provided options.

        Parameters:
        date - the Date object to format as String
        format - the format to use
        Returns:
        the formatted date
      • getDateShort

        public static java.lang.String getDateShort​(long time)
        Returns a formated date String form a timestamp value, the formatting based on the OpenCms system default locale and the CmsDateTimeUtil.Format.SHORT date format.

        Parameters:
        time - the time value to format as date
        Returns:
        the formatted date
      • getDateTime

        public static java.lang.String getDateTime​(java.util.Date date,
                                                   CmsDateTimeUtil.Format format)
        Returns a formated date and time String from a Date value, the formatting based on the provided options.

        Parameters:
        date - the Date object to format as String
        format - the format to use, see CmsDateTimeUtil.Format for possible values
        Returns:
        the formatted date
      • getDateTimeShort

        public static java.lang.String getDateTimeShort​(long time)
        Returns a formated date and time String form a timestamp value, the formatting based on the OpenCms system default locale and the CmsDateTimeUtil.Format.SHORT date format.

        Parameters:
        time - the time value to format as date
        Returns:
        the formatted date
      • getTime

        public static java.lang.String getTime​(java.util.Date date,
                                               CmsDateTimeUtil.Format format)
        Returns a formated time String from a Date value, the formatting based on the provided options.

        Parameters:
        date - the Date object to format as String
        format - the format to use
        Returns:
        the formatted time