-
-
Notifications
You must be signed in to change notification settings - Fork 770
2. Date Components
The following properties are available both for Date
(default region is used) and DateInRegion
(the region associated with the object is used).
- Get Date Components
Return the era of the receiver object.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of year of the receiver object.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the ISO 8601 week-numbering year of the receiver.
The Gregorian calendar defines a week to have 7 days, and a year to have 356 days, or 366 in a leap year. However, neither 356 or 366 divide evenly into a 7 day week, so it is often the case that the last week of a year ends on a day in the next year, and the first week of a year begins in the preceding year. To reconcile this, ISO 8601 defines a week-numbering year, consisting of either 52 or 53 full weeks (364 or 371 days), such that the first week of a year is designated to be the week containing the first Thursday of the year.
You can use the yearForWeekOfYear property with the weekOfYear and weekday properties to get the date corresponding to a particular weekday of a given week of a year. For example, the 6th day of the 53rd week of the year 2005 (ISO 2005-W53-6) corresponds to Sat 1 January 2005 on the Gregorian calendar.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return true
if the data represented by receiver is a leap year, false
otherwise.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of month units for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of days into the current month of the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of quarters for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the name of the current month for the receiver (ie. March
). The language used is retrieved from the current region's locale.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the short name of the current month of the receiver (ie. Mar
). The language used is retrieved from the current region's locale.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return true
if current month of the receiver is leap, false
otherwise.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the same date minus one month (as defined by associated calendar of the receiver).
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the same date plus one month (as defined by associated calendar of the receiver).
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the ISO 8601 week date of the year for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of the weekday unit for the receiver.
Weekday units are the numbers 1 through n, where n is the number of days in the week. For example, in the Gregorian calendar, n is 7 and Sunday is represented by 1.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the ordinal number of weekday units for the receiver.
Weekday ordinal units represent the position of the weekday within the next larger calendar unit , such as the month. For example, 2 is the weekday ordinal unit for the second Friday of the month.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the name of the week of the receiver (ie Monday
). String is localized in the same locale defined by the associated region of the receiver.
Weekday ordinal units represent the position of the weekday within the next larger calendar unit , such as the month. For example, 2 is the weekday ordinal unit for the second Friday of the month.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the short name of the week of the receiver (ie Mon
). String is localized in the same locale defined by the associated region of the receiver.
Weekday ordinal units represent the position of the weekday within the next larger calendar unit , such as the month. For example, 2 is the weekday ordinal unit for the second Friday of the month.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the day of the month of the current receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
The Modified Julian Date (MJD) was introduced by the Smithsonian Astrophysical Observatory in 1957 to record the orbit of Sputnik via an IBM 704 (36-bit machine) and using only 18 bits until August 7, 2576.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of hour units for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the nearest rounded hour from the date represented by the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
The number of minute units for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
The number of second units for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
The number of nanosecond units for the receiver.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Return the number of seconds since the reference date at 1 January 2001
.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Returns a boolean value that indicates whether the represented date uses daylight saving time.
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.
Returns a boolean value that indicates whether the represented absolute date uses daylight saving time when expressed in passed timezone..
-
tzName
(TimeZoneName
) destination timezone
The current daylight saving time offset of the represented date.
The current daylight saving time offset of the represented date when expressed in passed timezone.
-
tzName
(TimeZoneName
) destination timezone
- For
DateInRegion
the value is interpreted in the context of the calendar and locale of associatedRegion
.
- For
Date
the value is interpreted in the context of the Default Region set.