Dates.js
Additional date functions in a javascript file. Usefully when you want to perform some date calculations.
  • Enter a date, or select a date form the pop up calender, to see how the fuctions return the values of the date entered. Tab or click out of the "Test Date" field to activate functions.
  • Click Abbrievate to see how dayName and monthName functions abbrievate.
Test Date (mm/dd/yyyy)
Click here for a calendar.
Abbrievate (dayName & monthName)
Function Name Parameters Returns Description
dayName() date, format* The string calendar day name (ie., Tuesday)
monthName() date, format* The string calendar month name (ie., July)
dayPrefix() date The day number and a prefix (ie., 1st) Highest number 31
fullYear() date 4 digit year (ie., 2003)
isLeapYear() date 1 or 0
daysInYear() date The total days is a year (ie., 365)
dayOfYear() date The total days elasped in a year (ie., 182)
daysLeftInYear() date The total days remaining is a year (ie., 183)
quarter() date The quarter number (ie., 3)
daysInQuarter() date The total days in a quarter (ie., 92)
daysInMonth() date The total days in a month (ie., 31)
weekNumber() date The week number in the year (ie., 27)
julianDate() date Julian Date (ie., 2454267.8982)
numberPrefix() integer The number with a prefix (ie., 1st, 2nd, 3rd, 4th)
* OPTIONAL
  • date: string date '1/1/2005'
  • format:
    • '' = full length text, default
    • 'abbr' = three letter abbreviation
  • integer: whole number


Click here to see dates.js file.

 

Rate and/or tell us what you think of this demo.
Report a bug
Comments (Optional)