Date provides a set of utility functions to operate against Date objects.
addDays
oDate
numDays
Adds a specified number of days to the given date.
A new Date with the specified number of days added to the original date.
addMonths
oDate
numMonths
Adds a specified number of months to the given date.
A new Date with the specified number of months added to the original date.
addYears
oDate
numYears
Adds a specified number of years to the given date.
A new Date with the specified number of years added to the original date.
areEqual
aDate
bDate
Checks whether two dates correspond to the same date and time.
True if the two dates correspond to the same date and time.
daysInMonth
oDate
Takes a native JavaScript Date and returns the number of days in the month that the given date belongs to.
oDate
Date
Date in the month for which the number of days is desired.
A number (either 28, 29, 30 or 31) of days in the given month.
format
oDate
oConfig
Takes a native JavaScript Date and formats it as a string for display to user.
oDate
Date
Date.
oConfig
Object
(Optional) Object literal of configuration values:
Any strftime string is supported, such as "%I:%M:%S %p". strftime has several format specifiers defined by the Open group at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html PHP added a few of its own, defined at http://www.php.net/strftime
This javascript implementation supports all the PHP specifiers and a few more. The full list is below.
If not specified, it defaults to the ISO 8601 standard date format: %Y-%m-%d.
Formatted date for display.
isGreater
aDate
bDate
Checks whether the first date comes later than the second.
True if the first date is later than the second.
isGreaterOrEqual
aDate
bDate
Checks whether the first date comes later than or is the same as the second.
True if the first date is later than or the same as the second.
isInRange
aDate
bDate
cDate
Checks whether the date is between two other given dates.
True if the date is between the two other given dates.
isValidDate
oDate
Checks whether a native JavaScript Date contains a valid value.
oDate
Date
Date in the month for which the number of days is desired.
True if the date argument contains a valid value.
listOfDatesInMonth
oDate
Lists all dates in a given month.
oDate
Date
The date corresponding to the month for which a list of dates is required.
An Array
of Date
s from a given month.