DateTime
Tip
This is a builtin dotnet type. The documentation and api interface are generated from dotnet source files.
Represents an instant in time, typically expressed as a date and time of day.
Fields:
Day number
Gets the day of the month represented by this instance.
DayOfYear number
Gets the day of the year represented by this instance.
Hour number
Gets the hour component of the date represented by this instance.
Kind DateTimeKind
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
MaxValue DateTime
Represents the largest possible value of DateTime. This field is read-only.
Microsecond number
The microseconds component, expressed as a value between 0 and 999.
Millisecond number
Gets the milliseconds component of the date represented by this instance.
Minute number
Gets the minute component of the date represented by this instance.
MinValue DateTime
Represents the smallest possible value of DateTime. This field is read-only.
Month number
Gets the month component of the date represented by this instance.
Nanosecond number
The nanoseconds component, expressed as a value between 0 and 900 (in increments of 100 nanoseconds).
Now DateTime
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
Second number
Gets the seconds component of the date represented by this instance.
Ticks number
Gets the number of ticks that represent the date and time of this instance.
UnixEpoch DateTime
The value of this constant is equivalent to 00:00:00.0000000 UTC, January 1, 1970, in the Gregorian calendar. DateTime.UnixEpoch defines the point in time when Unix time is equal to 0.
Year number
Gets the year component of the date represented by this instance.
Constructors:
New(ticks: number) :
Initializes a new instance of the DateTime structure to a specified number of ticks.
Name | Type | Default | Summary |
ticks | number | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
New(ticks: number, kind: DateTimeKind) :
Initializes a new instance of the DateTime structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time.
Name | Type | Default | Summary |
ticks | number | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. | |
kind | DateTimeKind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
New(date: DateOnly, time: TimeOnly, kind: DateTimeKind) :
Initializes a new instance of the DateTime structure to the specified DateOnly and TimeOnly and respecting the specified DateTimeKind.
Name | Type | Default | Summary |
date | DateOnly | The date part. | |
time | TimeOnly | The time part. | |
kind | DateTimeKind | One of the enumeration values that indicates whether date and time specify a local time, Coordinated Universal Time (UTC), or neither. |
New(year: number, month: number, day: number) :
Initializes a new instance of the DateTime structure to the specified year, month, and day.
Name | Type | Default | Summary |
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). |
New(year: number, month: number, day: number, hour: number, minute: number, second: number) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, and second.
Name | Type | Default | Summary |
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). |
New(year: number, month: number, day: number, hour: number, minute: number, second: number, kind: DateTimeKind) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time.
Name | Type | Default | Summary |
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). | |
kind | DateTimeKind | One of the enumeration values that indicates whether year, month, day, hour, minute and second specify a local time, Coordinated Universal Time (UTC), or neither. |
New(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, second, and millisecond.
Name | Type | Default | Summary |
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). |
New(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, kind: DateTimeKind) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time.
Name | Type | Default | Summary |
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). | |
kind | DateTimeKind | One of the enumeration values that indicates whether year, month, day, hour, minute, second, and millisecond specify a local time, Coordinated Universal Time (UTC), or neither. |
New(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, microsecond: number) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time for the specified calendar.
Name | Type | Default | Summary |
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). | |
microsecond | number | The microseconds (0 through 999). |
New(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, microsecond: number, kind: DateTimeKind) :
Initializes a new instance of the DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time for the specified calendar.
Name | Type | Default | Summary |
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). | |
microsecond | number | The microseconds (0 through 999). | |
kind | DateTimeKind | One of the enumeration values that indicates whether year, month, day, hour, minute, second, and millisecond specify a local time, Coordinated Universal Time (UTC), or neither. |
Methods:
AddMicroseconds(value: number) : DateTime
Returns a new DateTime that adds the specified number of microseconds to the value of this instance.
Name | Type | Default | Summary |
value | number | A number of whole and fractional microseconds. The value parameter can be negative or positive. Note that this value is rounded to the nearest integer. |
AddMilliseconds(value: number) : DateTime
Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.
Name | Type | Default | Summary |
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. |