Formatting numeric values in JavaScript
Learn common number formatting operations, such as rounding, padding, optional decimal marks, currency, seconds, bytes, and more.
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.
Learn common number formatting operations, such as rounding, padding, optional decimal marks, currency, seconds, bytes, and more.
Leverage the Date
object to check if a given date is inside business hours.
Learn how to calculate date difference in seconds, minutes, hours, days etc. in vanilla JavaScript.
Learn how you can implement a delay function using setTimeout()
, promises and async
/await
.
Learn how to manipulate Date
objects to add minutes, hours, days and more.
Learn how you can check if a valid date object can be created from the given values.
Get the name of the weekday from a JavaScript Date
object.
Determine the day, week, month, or quarter of the year that a date corresponds to, using vanilla JavaScript.
Create a generator that generates all dates in a given range.
Convert a date to extended ISO format (ISO 8601), including timezone offset.
Quickly find the minimum or maximum date in an array of dates.
Get the time part of a Date object in the format HH:MM:SS.
Learn how you can compare two dates in JavaScript, determining which one comes before or after the other.
Calculate the number of days in a month for a given year using JavaScript.
Easily calculate the date of yesterday, today or tomorrow in JavaScript.
Quickly and easily determine if a given JavaScript Date
object is a weekday or weekend.
Calculate the date of n
days ago from today or the date of n
days from now.
Use the Date
object and some clever tricks to get the first or last date of a month in JavaScript.
Having a hard time wrapping your head around the math involved in checking for leap years? You might not need to!
Easily convert between a JavaScript Date object and a Unix timestamp.