Date
19 snippets
Relative Time
VerifiedFormats a date relative to now ("3 hours ago", "in 2 days"), localized via Intl.
Calculate Date Difference in Milliseconds
Calculates the difference between two dates in milliseconds.
Check if Date is a Weekend
Checks whether a given date falls on a weekend.
Check Leap Year
Determines if a given year is a leap year.
Convert to Unix Timestamp
Converts a date to a Unix timestamp in seconds.
Date Time Formatting American
Formats a timestamp to a human-readable date-time string in the format "MM/dd/yyyy hh:mm:ss a"
Date Time Formatting European
Formats a timestamp to a human-readable date-time string in the format "dd.MM.yyyy HH:mm:ss"
Day of the Week String
Gets the string of the day of the week for a given date.
Duration Formatting Hours Minutes Seconds
Converts a given time duration to a human-readable string in the format "hh:mm(:ss)"
Duration Formatting Minutes Seconds
Converts a given time duration to a human-readable string in the format "mm:ss"
Format Date
Formats a date in 'YYYY-MM-DD' format.
Generate Date Range List
Generates a list of dates between two given dates.
Get Current Date and Time as String
Fetches the current date and time as a formatted string.
Get Day of the Year
Calculates the day of the year (1-365 or 1-366 for leap years) for a given date.
Get Days in Month
Calculates the number of days in a specific month of a given year.
Get Number of Days in a Month
Determines the number of days in a specific month and year.
Get Time Difference
Calculates the time difference in days between two dates.
Measure Execution Time
Measures the execution time of a code block.
Start of the Day
Returns the start of the day (midnight) for a given date.