Date

Summary

A class for representing dates and times.

Description

System.Date is a class used for representing dates and times.

Time values are relative to 1 January, 1970 00:00:00:00.

Compatibility with JavaScript

The implementation-dependent method, Date.parse, was removed as its behavior was not clearly defined until ECMAScript 5.

Examples

Instantiation
1
2
3
import System;
 
System.Date d = new System.Date();
Get Current Timestamp
1
2
3
import System;
 
Date d = new Date();

Methods

  • compare

    Compares the Date object to another Date object.

  • Date (Constructor)

    Constructs a System.Date object.

  • getDate

    Returns the day of the month of the System.Date object according to local time.

  • getDay

    Returns the day of the week of the System.Date object according to local time. In order to maintain compatibility with ECMAScript, this method does not return a System.Date.Weekday enumeration value. A cast isavailable from the return value of getDay() to the`System.

  • getDayOfMonth

    Returns the day of the month of the System.Date object according to local time.

  • getFullYear

    Returns the year of the System.Date object, according to localtime, in a human-readable format.

  • getHours

    Returns the hour of the System.Date object according to local time.

  • getMilliseconds

    Returns the milliseconds of the System.Date object according to local time.

  • getMinutes

    Returns the minute of the System.Date object according to local time.

  • getMonth

    Returns the month of the System.Date object according to local time.

  • getSeconds

    Returns the seconds of the System.Date object according to local time.

  • getTime

    Returns the time value in milliseconds.

  • getTimezoneOffset

    Returns the timezone offset in minutes from the host computer to Coordinated Universal Time (UTC).

  • getUTCDate

    Returns the day of the month of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCDay

    Returns the day of the week of the System.Date object according to Coordinated Universal Time (UTC). In order to maintain compatibility with ECMAScript, this method does not return a System.Date.Weekday enumeration value. A cast isavailable from the return value of getUTCDay() to the`System.

  • getUTCDayOfMonth

    Returns the day of the month of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCFullYear

    Returns the year of the System.Date object, according toCoordinated Universal Time (UTC), in a human-readable format.

  • getUTCHours

    Returns the hour of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCMilliseconds

    Returns the milliseconds of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCMinutes

    Returns the minute of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCMonth

    Returns the month of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCSeconds

    Returns the seconds of the System.Date object according to Coordinated Universal Time (UTC).

  • getUTCWeekday

    Returns the day of the week of the System.Date object according to Coordinated Universal Time (UTC). In order to maintain API consistency and compatibility withECMAScript, this method does not return a System.Date.Weekday enumeration value just as with `System.

  • getWeekday

    Returns the day of the week of the System.Date object according to local time. In order to maintain API consistency and compatibility withECMAScript, this method does not return a System.Date.Weekday enumeration value just as with `System.Date.

  • Month

    An enumeration representing the months of the year.

  • setDate

    Sets the day of the month for the System.Date object according to local time.

  • setDayOfMonth

    Sets the day of the month for the System.Date object according to local time.

  • setFullYear

    Sets the year of the System.Date object according to local time.

  • setHours

    Sets the hours of the System.Date object according to local time.

  • setMilliseconds

    Sets the milliseconds of the System.Date object according to local time.

  • setMinutes

    Sets the minutes of the System.Date object according to local time.

  • setMonth

    Sets the month of the year for the System.Date object.

  • setSeconds

    Sets the seconds of the System.Date object according to local time.

  • setTime

    Sets the time value of the System.Date object.

  • setUTCDate

    Sets the day of the month for the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCDayOfMonth

    Sets the day of the month for the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCFullYear

    Sets the year of the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCHours

    Sets the hours of the System.Date object according to local time.

  • setUTCMilliseconds

    Sets the milliseconds of the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCMinutes

    Sets the minutes of the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCMonth

    Sets the month of the year for the System.Date object according to Coordinated Universal Time (UTC).

  • setUTCSeconds

    Sets the seconds of the System.Date object according to Coordinated Universal Time (UTC).

  • toExternal

    Constructs a new external Date object with the value of the internal Date object.

  • toString

    Returns a string representation of the current date/time value held by the System.Date object. The string representation is guaranteed to be in the following format: Thu Jul 01 2017 00:00:00 UTC-0700.

  • UTC

    Returns the number of milliseconds elapsed since 1 January, 1970 00:00:00:00 in Coordinated Universal Time (UTC).

  • Weekday

    An enumeration representing the days of the week.

Share

HTML | BBCode | Direct Link