aspose.cells

Class DateTime

Represents an instant in time, typically expressed as a date and time of day.

Constructor Summary
DateTime(year, month, day)
Initializes a new instance of the DateTime object to the specified year, month, and day.
DateTime(year, month, day, hour, minute, second)
Initializes a new instance of the DateTime object to the specified year, month, day, hour, minute, and second.
DateTime(year, month, day, hour, minute, second, millisecond)
Initializes a new instance of the DateTime object to the specified year, month, day, hour, minute, second, and millisecond.
DateTime(date)
Initializes a new instance of the DateTime object to the specified Date object
DateTime(cld)
Initializes a new instance of the DateTime object to the specified Calendar object
 
Method Summary
functionaddDays(value)
Adds the specified number of days to the value of this instance.
functionaddHours(value)
Adds the specified number of hours to the value of this instance.
functionaddMilliseconds(value)
Adds the specified number of milliseconds to the value of this instance.
functionaddMinutes(value)
Adds the specified number of minutes to the value of this instance.
functionaddMonths(months)
Adds the specified number of months to the value of this instance.
functionaddSeconds(value)
Adds the specified number of seconds to the value of this instance.
functionaddYears(value)
Adds the specified number of years to the value of this instance.
functioncompareTo(value)
Compares the value of this instance to a specified DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
functioncompareTo(value)
Compares the value of this instance to a specified object that contains a specified DateTime value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
functionequals(value)
Returns a value indicating whether this instance is equal to a specified object.
functiongetDay()
Gets the day of the month represented by this instance.
functiongetDayOfWeek()
Gets the day of the week represented by this instance.
functiongetDayOfYear()
Gets the day of the year represented by this instance.
functiongetHour()
Gets the hour component of the date represented by this instance.
functiongetMillisecond()
Gets the milliseconds component of the date represented by this instance.
functiongetMinute()
Gets the minute component of the date represented by this instance.
functiongetMonth()
Gets the month component of the date represented by this instance.
static functiongetNow()
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
functiongetSecond()
Gets the seconds component of the date represented by this instance.
functiongetYear()
Gets the year component of the date represented by this instance.
functionhashCode()
Returns the hash code for this instance.
functiontoCalendar()
Converts the value of the current DateTime object to Calendar object.
functiontoDate()
Converts the value of the current DateTime object to Date object.
functiontoLocalTime()
Converts the value of the current DateTime object to local time.
functiontoString()
Converts the value of the current DateTime object to its equivalent string representation.
functiontoUniversalTime()
Converts the value of the current DateTime object to Coordinated Universal Time(UTC).
 

    • Constructor Detail

      • DateTime

        function DateTime(year, month, day)
        Initializes a new instance of the DateTime object to the specified year, month, and day.
        Parameters:
        year: Number - The year (1 through 9999).
        month: Number - The month (1 through 12).
        day: Number - The day (1 through the number of days in month).
      • DateTime

        function DateTime(year, month, day, hour, minute, second)
        Initializes a new instance of the DateTime object to the specified year, month, day, hour, minute, and second.
        Parameters:
        year: Number - The year (1 through 9999).
        month: Number - The month (1 through 12).
        day: Number - The day (1 through the number of days in month).
        hour: Number - The hours (0 through 23).
        minute: Number - The minutes (0 through 59).
        second: Number - The seconds (0 through 59).
      • DateTime

        function DateTime(year, month, day, hour, minute, second, millisecond)
        Initializes a new instance of the DateTime object to the specified year, month, day, hour, minute, second, and millisecond.
        Parameters:
        year: Number - The year (1 through 9999).
        month: Number - The month (1 through 12).
        day: Number - The day (1 through the number of days in month).
        hour: Number - The hours (0 through 23).
        minute: Number - The minutes (0 through 59).
        second: Number - The seconds (0 through 59).
        millisecond: Number - The milliseconds (0 through 999).
      • DateTime

        function DateTime(date)
        Initializes a new instance of the DateTime object to the specified Date object
        Parameters:
        date: Date - The Date object
      • DateTime

        function DateTime(cld)
        Initializes a new instance of the DateTime object to the specified Calendar object
        Parameters:
        cld: Calendar - The Calendar object
    • Method Detail

      • toDate

        function toDate()
        Converts the value of the current DateTime object to Date object.
        Returns:
        Date object
      • toCalendar

        function toCalendar()
        Converts the value of the current DateTime object to Calendar object.
        Returns:
        Calendar object
      • toUniversalTime

        function toUniversalTime()
        Converts the value of the current DateTime object to Coordinated Universal Time(UTC).
        Returns:
        A DateTime object of UTC
      • toLocalTime

        function toLocalTime()
        Converts the value of the current DateTime object to local time.
        Returns:
        A DateTime object of local
      • addDays

        function addDays(value)
        Adds the specified number of days to the value of this instance.
        Parameters:
        value: Number - A number of whole and fractional days. The value parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of days represented by value.
      • addHours

        function addHours(value)
        Adds the specified number of hours to the value of this instance.
        Parameters:
        value: Number - A number of whole and fractional hours. The value parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of hours represented by value.
      • addMilliseconds

        function addMilliseconds(value)
        Adds the specified number of milliseconds to the value of this instance.
        Parameters:
        value: Number - A number of whole and fractional milliseconds. The value parameter can be negative or positive. Note that this value is rounded to the nearest integer.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of milliseconds represented by value.
      • addMinutes

        function addMinutes(value)
        Adds the specified number of minutes to the value of this instance.
        Parameters:
        value: Number - A number of whole and fractional minutes. The value parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of minutes represented by value.
      • addMonths

        function addMonths(months)
        Adds the specified number of months to the value of this instance.
        Parameters:
        months: Number - A number of months. The months parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and months.
      • addSeconds

        function addSeconds(value)
        Adds the specified number of seconds to the value of this instance.
        Parameters:
        value: Number - A number of whole and fractional seconds. The value parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of seconds represented by value.
      • addYears

        function addYears(value)
        Adds the specified number of years to the value of this instance.
        Parameters:
        value: Number - A number of years. The value parameter can be negative or positive.
        Returns:
        A DateTime object whose value is the sum of the date and time represented by this instance and the number of years represented by value.
      • compareTo

        function compareTo(value)
        Compares the value of this instance to a specified object that contains a specified DateTime value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
        Parameters:
        value: Object - A boxed DateTime object to compare, or null.
        Returns:
        A signed number indicating the relative values of this instance and value. Value Description Less than zero This instance is earlier than value. Zero This instance is the same as value. Greater than zero This instance is later than value, or value is null.
      • compareTo

        function compareTo(value)
        Compares the value of this instance to a specified DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
        Parameters:
        value: DateTime - A DateTime object to compare.
        Returns:
        A signed number indicating the relative values of this instance and the value parameter. Value Description Less than zero This instance is earlier than value. Zero This instance is the same as value. Greater than zero This instance is later than value.
      • hashCode

        function hashCode()
        Returns the hash code for this instance.
        Returns:
        A 32-bit signed integer hash code.
      • equals

        function equals(value)
        Returns a value indicating whether this instance is equal to a specified object.
        Parameters:
        value: Object - An object to compare to this instance.
        Returns:
        true if value is an instance of DateTime and equals the value of this instance; otherwise, false.
      • getDay

        function getDay()
        Gets the day of the month represented by this instance.
        Returns:
        The day component, expressed as a value between 1 and 31.
      • getDayOfWeek

        function getDayOfWeek()
        Gets the day of the week represented by this instance.
        Returns:
        the day of the week of this DateTime value.
      • getDayOfYear

        function getDayOfYear()
        Gets the day of the year represented by this instance.
        Returns:
        The day of the year, expressed as a value between 1 and 366.
      • getHour

        function getHour()
        Gets the hour component of the date represented by this instance.
        Returns:
        The hour component, expressed as a value between 0 and 23.
      • getMillisecond

        function getMillisecond()
        Gets the milliseconds component of the date represented by this instance.
        Returns:
        The milliseconds component, expressed as a value between 0 and 999.
      • getMinute

        function getMinute()
        Gets the minute component of the date represented by this instance.
        Returns:
        The minute component, expressed as a value between 0 and 59.
      • getMonth

        function getMonth()
        Gets the month component of the date represented by this instance.
        Returns:
        The month component, expressed as a value between 1 and 12.
      • getNow

        static function getNow()
        Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
        Returns:
        A DateTime object whose value is the current local date and time.
      • getSecond

        function getSecond()
        Gets the seconds component of the date represented by this instance.
        Returns:
        The seconds, between 0 and 59.
      • getYear

        function getYear()
        Gets the year component of the date represented by this instance.
        Returns:
        The year, between 1 and 9999.
      • toString

        function toString()
        Converts the value of the current DateTime object to its equivalent string representation.
        Returns:
        A string representation of the value of the current DateTime object.