Lua API
On this page

DateOnly

Tip

This is a builtin dotnet type. The documentation and api interface are generated from dotnet source files.

Represents dates with values ranging from January 1, 0001 Anno Domini (Common Era) through December 31, 9999 A.D. (C.E.) in the Gregorian calendar.

Fields:

Day number

read only

Gets the day component of the date represented by this instance.

DayNumber number

read only

Gets the number of days since January 1, 0001 in the Proleptic Gregorian calendar represented by this instance.

DayOfWeek DayOfWeek

read only

Gets the day of the week represented by this instance.

DayOfYear number

read only

Gets the day of the year represented by this instance.

MaxValue DateOnly

staticread only

Gets the latest possible date that can be created.

MinValue DateOnly

staticread only

Gets the earliest possible date that can be created.

Month number

read only

Gets the month component of the date represented by this instance.

Year number

read only

Gets the year component of the date represented by this instance.

Constructors:

New(year: number, month: number, day: number) :

Creates a new instance of the DateOnly structure to the specified year, month, and day.

Parameters:
NameTypeDefaultSummary
yearnumber

The year (1 through 9999).

monthnumber

The month (1 through 12).

daynumber

The day (1 through the number of days in month).

Methods:

AddDays(value: number) : DateOnly

Adds the specified number of days to the value of this instance.

Parameters:
NameTypeDefaultSummary
valuenumber

The number of days to add. To subtract days, specify a negative number.

Returns:DateOnly

AddMonths(value: number) : DateOnly

Adds the specified number of months to the value of this instance.

Parameters:
NameTypeDefaultSummary
valuenumber

A number of months. The months parameter can be negative or positive.

Returns:DateOnly

AddYears(value: number) : DateOnly

Adds the specified number of years to the value of this instance.

Parameters:
NameTypeDefaultSummary
valuenumber

A number of years. The value parameter can be negative or positive.

Returns:DateOnly

CompareTo(value?: Object) : number

Compares the value of this instance to a specified object that contains a specified DateOnly value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

Parameters:
NameTypeDefaultSummary
valueObject

A boxed object to compare, or null.

Returns:number

CompareTo(value: DateOnly) : number

Compares the value of this instance to a specified DateOnly value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

Parameters:
NameTypeDefaultSummary
valueDateOnly

The object to compare to the current instance.

Returns:number

Deconstruct()

FromDateTime(dateTime) dateTime DateTime

FromDayNumber(dayNumber) dayNumber number

Parse(s) s string

ParseExact(s,format) s string , format string

ParseExact(s,formats) s string , formats string

ToDateTime(time,kind) time TimeOnly , kind DateTimeKind

ToDateTime(time) time TimeOnly

ToLongDateString()

ToShortDateString()

ToString()

ToString(format) format string

TryParse(s) s string

TryParseExact(s,format) s string , format string

TryParseExact(s,formats) s string , formats string