Date Methods
The methods defined in the Date primitive type are summarized in the following table.
Method | Description |
---|---|
day | Returns the day of the month as an integer |
dayName | Returns the name of the day of the week as a string |
dayNameWithLcid | Returns the name of the day of the week as a string for the specified locale |
dayOfWeek | Returns an integer value for the day of the week |
dayOfYear | Returns an integer value for the day of the year |
daysInMonth | Returns an integer value of the days in the month of the date of the receiver |
display | Returns the date as a string |
format | Returns the date as a string in the specified format |
isFormatable | Returns true if the date falls within the valid conversion range for the execution platform |
isLeapYear | Returns true if the year is a leap year |
isValid | Returns true if the date is valid |
lastOccurrenceOfDayInMonth | Returns the date identical to the receiver except that the day is modified to the last occurrence that matches the specified day of the week |
longFormat | Returns the date as a string in the long date format |
month | Returns the month as an integer |
monthName | Returns the name of the month |
monthNameWithLcid | Returns the name of the month for the specified locale |
nthOccurrenceOfDayInMonth | Returns the date identical to the receiver except the day is modified to match the specified nth occurrence (for example, 1st or 2nd) that matches the specified day of the week |
parseForCurrentLocale | Sets the receiver to the result of parsing a string representing a date for the current locale |
parseLongWithCurrentLocale | Sets the receiver to the result of parsing a string representing a date in the long date format for the current locale |
parseLongWithFmtAndLcid | Sets the receiver to the result of parsing a string representing a date for the specified long date format and the specified locale |
parseLongWithPicAndLcid | Sets the receiver to the result of parsing a string representing a date for the specified long date picture and the specified locale |
parseShortWithCurrentLocale | Sets the receiver to the result of parsing a string representing a date in the short date format for the current locale |
parseShortWithFmtAndLcid | Sets the receiver to the result of parsing a string representing a date for the specified short date format and the specified locale |
parseShortWithPicAndLcid | Sets the receiver to the result of parsing a string representing a date for the specified short date picture and the specified locale |
setByteOrderLocal | Returns a date that has the bytes ordered as required by the local node |
setByteOrderRemote | Returns a date that has the bytes ordered as required by the specified remote node |
setDate | Sets the receiver to a specified date |
setDateYearAbsolute | Sets the receiver to a specific absolute date |
shortDayNameWithLcid | Returns the short name of the week day for the specified locale |
shortFormat | Returns the date in the short date format |
shortMonthNameWithLcid | Returns the short name of the month for the specified locale |
subtract | Returns the interval between the receiver and the specified date |
userFormat | Returns the date as a string in the specified date format |
userLongFormatAndLcid | Returns the date as a string in the specified long date format for the specified locale |
userLongFormatPicAndLcid | Returns the date as a string formatted in the specified long date picture for the specified locale |
userShortFormatAndLcid | Returns the date as a string in the specified short date format for the specified locale |
userShortFormatPicAndLcid | Returns the date as a string formatted in the specified short date picture for the specified locale |
year | Returns the year as in integer |