date

Comprehensive date and time manipulation utilities with support for multiple formats, locales, and timezone handling.

Functions

Function
Description
Example

days

Returns array of day names in specified language

dphelper.date.days('en')

months

Returns array of month names in specified language

dphelper.date.months('en')

year

Returns current year

dphelper.date.year()

toIso

Converts date to ISO format (localized)

dphelper.date.toIso(value, 'en')

toMMDDYYYY

Converts to MMDDYYYY format

dphelper.date.toMMDDYYYY(value)

toYYYYMMDD

Converts to YYYYMMDD format (database-friendly)

dphelper.date.toYYYYMMDD(value)

toHuman

Converts to human-readable format

dphelper.date.toHuman(value)

convert

Converts date between formats using month array

dphelper.date.convert(value, format)

iso2Epoch

Converts ISO date to epoch milliseconds

dphelper.date.iso2Epoch(value)

localIsoTime

Gets local ISO time for a date

dphelper.date.localIsoTime(value)

utc

Gets current UTC time string

dphelper.date.utc()

parse

Parses date with custom separator

dphelper.date.parse(value, '/')

addDays

Adds days to a date

dphelper.date.addDays(date, 5)

dateTimeToString

Converts date to formatted string

dphelper.date.dateTimeToString(date)

isoToHuman

Converts ISO to human format with time

dphelper.date.isoToHuman(value, '@')

fullDate

Returns DD-MM-YYYY HH:MM:SS format

dphelper.date.fullDate()

epoch

Returns current epoch time in milliseconds

dphelper.date.epoch()

diffInDays

Calculates difference between two dates in days

dphelper.date.diffInDays(d1, d2)

diffInWeeks

Calculates difference between two dates in weeks

dphelper.date.diffInWeeks(d1, d2)

diffInMonths

Calculates difference between two dates in months

dphelper.date.diffInMonths(d1, d2)

diffInYears

Calculates difference between two dates in years

dphelper.date.diffInYears(d1, d2)

dateToYMD

Converts date to YYYY-MM-DD format

dphelper.date.dateToYMD(date)

collection

Returns various date format representations

dphelper.date.collection({ type: 'toISOString' })

timeZones

Returns array of all supported timezones

dphelper.date.timeZones()

Description

Complete date manipulation library providing:

  • Format Conversion - ISO, MMDDYYYY, YYYYMMDD, human-readable

  • Localization - Multi-language day/month names

  • Timezone Support - UTC, local time, timezone list

  • Date Arithmetic - Add days, calculate differences

  • Epoch/Unix Time - Convert to/from milliseconds

  • Date Collections - Multiple format representations

Usage Examples

Getting Current Date Information

Format Conversions

Date Parsing

Date Arithmetic

Date Differences

Epoch/Unix Time Conversion

Local vs UTC Time

Date Collection (Multiple Formats)

Localization

Advanced Usage

Date Range Calculator

Timestamp Logger

Database Date Handler

Details

  • Author: Dario Passariello

  • Version: 0.0.2

  • Creation Date: 20210101

  • Last Modified: 20260220

  • Environment: Works in both client and server environments


Automatically generated document

Last updated