JavaScript Date Snippets
The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Returns the human-readable format of the given number of milliseconds.
Learn all the different ways you can implement a
sleep()
function in JavaScript.Calculates the date of
n
minutes from the given date, returning its string representation.Counts the weekdays between two dates.
Converts a date to extended ISO format (ISO 8601), including timezone offset.
Checks if a valid date object can be created from the given values.
Calculates the date after adding the given number of business days.
Calculates the date of
n
days from the given date, returning its string representation.Checks if the given string is valid in the simplified extended ISO format (ISO 8601).
Returns a string of the form
HH:MM:SS
from aDate
object.Returns the quarter and year to which the supplied date belongs to.
Gets the day of the year (number in the range 1-366) from a
Date
object.Returns the maximum of the given dates.
Returns the minimum of the given dates.
Gets the name of the weekday from a
Date
object.