View source code
							
							
						
								Display the source code in std/datetime/date.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Struct std.datetime.date.Date
Represents a date in the Proleptic Gregorian Calendar ranging from 32,768 B.C. to 32,767 A.D. Positive years are A.D. Non-positive years are B.C.
						
				struct Date
				;
						
					
				Year, month, and day are kept separately internally so that Date is
    optimized for calendar-based operations.
    Date uses the Proleptic Gregorian Calendar, so it assumes the Gregorian
    leap year calculations for its entire length. As per
    ISO 8601, it treats 1 B.C. as
    year 0, i.e. 1 B.C. is 0, 2 B.C. is -1, etc. Use yearBC to use B.C.
    as a positive integer with 1 B.C. being the year prior to 1 A.D.
Year 0 is a leap year.
Constructors
| Name | Description | 
|---|---|
| this | |
| this | 
Properties
| Name | Type | Description | 
|---|---|---|
| day[get] | ubyte | Day of a Gregorian Month. | 
| day[set] | int | Day of a Gregorian Month. | 
| dayOfGregorianCal[get] | int | The Xth day of the Gregorian Calendar that this Dateis on. | 
| dayOfGregorianCal[set] | int | The Xth day of the Gregorian Calendar that this Dateis on. | 
| dayOfWeek[get] | DayOfWeek | Day of the week this Dateis on. | 
| dayOfYear[get] | ushort | Day of the year this Dateis on. | 
| dayOfYear[set] | int | Day of the year. | 
| daysInMonth[get] | ubyte | The last day in the month that this Dateis in. | 
| endOfMonth[get] | Date | Datefor the last day in the month that thisDateis in. | 
| isAD[get] | bool | Whether the current year is a date in A.D. | 
| isLeapYear[get] | bool | Whether this Dateis in a leap year. | 
| isoWeek[get] | ubyte | The ISO 8601 week of the year that this Dateis in. | 
| julianDay[get] | long | The Julian day for this Dateat noon (since the Julian day changes at noon). | 
| max[get] | Date | Returns the Datefarthest in the future which is representable
        byDate. | 
| min[get] | Date | Returns the Datefarthest in the past which is representable byDate. | 
| modJulianDay[get] | long | The modified Julian day for any time on this date (since, the modified Julian day changes at midnight). | 
| month[get] | Month | Month of a Gregorian Year. | 
| month[set] | Month | Month of a Gregorian Year. | 
| year[get] | short | Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. | 
| year[set] | int | Year of the Gregorian Calendar. Positive numbers are A.D. Non-positive are B.C. | 
| yearBC[get] | ushort | Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. | 
| yearBC[set] | int | Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. | 
Methods
| Name | Description | 
|---|---|
| add | Adds the given number of years or months to this Date, mutating
        it. A negative number will subtract. | 
| diffMonths | Returns the difference between the two Dates in months. | 
| fromISOExtString | Creates a Datefrom a string with the format YYYY-MM-DD.
        Whitespace is stripped from the given string. | 
| fromISOString | Creates a Datefrom a string with the format YYYYMMDD. Whitespace
        is stripped from the given string. | 
| fromSimpleString | Creates a Datefrom a string with the format YYYY-Mon-DD.
        Whitespace is stripped from the given string. | 
| opBinary | Gives the result of adding or subtracting a Durationfrom | 
| opBinary | Gives the difference between two Dates. | 
| opCmp | Compares this Datewith the givenDate. | 
| opOpAssign | Gives the result of adding or subtracting a Durationfrom thisDate, as well as assigning the result to thisDate. | 
| roll | Adds the given number of years or months to this Date, mutating
        it. A negative number will subtract. | 
| roll | Adds the given number of units to this Date, mutating it. A
        negative number will subtract. | 
| toISOExtString | Converts this Dateto a string with the formatYYYY-MM-DD.
        Ifwriteris set, the resulting string will be written directly
        to it. | 
| toISOString | Converts this Dateto a string with the formatYYYYMMDD.
        Ifwriteris set, the resulting string will be written directly
        to it. | 
| toSimpleString | Converts this Dateto a string with the formatYYYY-Mon-DD.
        Ifwriteris set, the resulting string will be written directly
        to it. | 
| toString | Converts this Dateto a string. | 
Example
import coreAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.