Class DateTime

    • Constructor Summary

      Constructors 
      Constructor Description
      DateTime()
      Creates a new DateTime object representing the actual day.
      DateTime​(int _year, int _month, int _day, int _hours, int _minutes, int _seconds)
      Creates a new date object.
      DateTime​(Date date, Time time)
      Creates a new DateTime object from a date and a day-time.
      DateTime​(String literal)
      Parses a DateTime literal and creates a new corresponding Date object.
    • Field Detail

      • UNINITIALIZED_DATE_TIME

        public static final DateTime UNINITIALIZED_DATE_TIME
        An uninitialized date object
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • INVALID

        public static final DateTime INVALID
        An invalid datetime object. Used by the widget validation
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • Constructor Detail

      • DateTime

        public DateTime()
        Creates a new DateTime object representing the actual day.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • DateTime

        public DateTime​(int _year,
                        int _month,
                        int _day,
                        int _hours,
                        int _minutes,
                        int _seconds)
        Creates a new date object.
        Parameters:
        _year - The year of the DateTime object.
        _month - The month of the DateTime object. 1=January, 2=February .. 11=November, 12=December
        _day - The day of the DateTime object. 1..28, 29, 30, 31 depending on month
        _hours - The hours of the DateTime object.
        _minutes - The minutes of the DateTime object.
        _seconds - The seconds of the DateTime object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • DateTime

        public DateTime​(Date date,
                        Time time)
        Creates a new DateTime object from a date and a day-time.
        Parameters:
        date -
        time -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • DateTime

        public DateTime​(String literal)
        Parses a DateTime literal and creates a new corresponding Date object.

        If the format of the argument is not correct, an IllegalArgumentException will be thrown.

        Parameters:
        literal - A date literal in the format
        • yyyy-mm-dd hh:mm:ss or
        • yyyy-mm-dd hh:mm or
        • dd.mm.yyyy hh:mm:ss or
        • dd.mm.yyyy hh:mm.
        The date an time parts may also be separated by the letter 'T'.
        Throws:
        IllegalArgumentException - if the argument has an illegal format.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • Method Detail

      • getDate

        public Date getDate()
        Returns Date part of this DateTime
        Returns:
        Date part of this DateTime
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getTime

        public Time getTime()
        Returns Time part of this DateTime
        Returns:
        Time part of this DateTime
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getYear

        public int getYear()
        Returns the year of this DateTime object.
        Returns:
        The year of this DateTime object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getMonth

        public int getMonth()
        Returns the month of this DateTime object.
        Returns:
        The month of this DateTime object. 1=January, 2=February .. 11=November, 12=December
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDay

        public int getDay()
        Returns the day of this DateTime object.
        Returns:
        The day of this DateTime object. 1..28, 29, 30, 31 depending on month
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDayOfWeek

        public int getDayOfWeek()
        Returns the day of the week for this DateTime object.
        Returns:
        The day of the week for this DateTime object. 1=Sunday, 2=Monday, .. 6=Friday, 7=Saturday
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getHours

        public int getHours()
        Returns the hours for this DateTime object.
        Returns:
        The hours for this DateTime object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getMinutes

        public int getMinutes()
        Returns the minutes for this DateTime object.
        Returns:
        The minutes for this DateTime object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getSeconds

        public int getSeconds()
        Returns the seconds for this DateTime object.
        Returns:
        The seconds for this DateTime object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • add

        public DateTime add​(Duration duration)
        Adds a duration to this date.
        Parameters:
        duration - A duration.
        Returns:
        A new date object translated by the duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • minus

        public DateTime minus​(Duration duration)
        Subtracts a duration to this date.
        Parameters:
        duration - A duration.
        Returns:
        A new date objact translated by the duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • minus

        public Duration minus​(DateTime dateTime)
        Returns a normalized Duration representing the difference between this DateTime and the argument. The result Duration has no year or month part.
        Parameters:
        dateTime -
        Returns:
        The difference between durations.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getDurationFromNow

        public Duration getDurationFromNow()
        Calculates the duration from the current dateTime to actual dateTime instance.
        Returns:
        Duration from the current dateTime to actual dateTime instance.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toNumber

        public long toNumber()
        Converts this date to a number; this is the number of second of this date after 1970-01-01 00:00:00.
        Returns:
        Number of seconds after 1970-01-01 00:00:00.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • compareTo

        public int compareTo​(DateTime otherDateTime)
        Compares two DataTime objects.
        Parameters:
        otherDateTime - Some date.
        Returns:
        -1 if the receiver is before the argument, 0 if the receiver is equal to the argument 1 if the receiver is after the argument.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toString

        public String toString()
        Returns the date as String in the ISO-8601 format (yyyy-mm-dd hh:mm:ss).
        Returns:
        The date as String in the ISO-8601 format (yyyy-mm-dd).
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toIvyDate

        public Date toIvyDate()
        Returns Date part of this DateTime
        Returns:
        Date part of this DateTime
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toTime

        public Time toTime()
        Returns Time part of this DateTime
        Returns:
        Time part of this DateTime
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • format

        public String format()
        Formats this DateTime with the default format.
        The default format is defined in the configuration under Formats > DateTime > default.
        Returns:
        formatted String
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • format

        public String format​(String formatName)
        Formats this DateTime with the given format config.
        Parameters:
        formatName - Name of a configuration under Formats > DateTime.
        E.g. "default", "medium", "short" etc.
        Returns:
        formatted String
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • format

        public String format​(String dateFormatName,
                             String timeFormatName)
        Formats this DateTime with the given format configurations for the date and time part.
        Parameters:
        dateFormatName - Name of a configuration under Formats > Date.
        E.g. "default", "medium", "short" etc.
        timeFormatName - Name of a configuration under Formats > Time.
        E.g. "default", "medium", "short" etc.
        Returns:
        formatted String
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • equals

        public boolean equals​(Object anotherDate)
        Test two objects for euality.
        Parameters:
        anotherDate - Some object.
        Returns:
        true if the receiver is equal to the argument.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • hashCode

        public int hashCode()
        A hashcode; the number of seconds after 1970-01-01.
        Returns:
        A hashcode.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • clone

        public DateTime clone()
        Creates a clone of this object.
        Specified by:
        clone in interface IIvyDataObject
        Returns:
        A shallow clone.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.