The Date object to format
Configuration options
The locale/language to use for formatting (e.g., "en", "de", "ar")
The format pattern or preset ("short", "medium", "long", "full", or custom pattern)
The timezone to use (default: "UTC+0")
The formatted date string according to the specified locale and format
Supported format tokens:
YYYY - 4-digit yearYY - 2-digit yearMMMM - Full month nameMMM - Short month nameMM - 2-digit month (01-12)M - 1-digit month (1-12)DDDD - Full weekday nameDDD - Short weekday nameDD - 2-digit day (01-31)D - 1-digit day (1-31)Do - Day with ordinal suffix (1st, 2nd, 3rd)HH - 2-digit hour (00-23)H - 1-digit hour (0-23)mm - 2-digit minute (00-59)m - 1-digit minute (0-59)ss - 2-digit second (00-59)s - 1-digit second (0-59)toDate(new Date()) // Uses default locale and short format
toDate(new Date(), {locale: "de"}) // "12.11.2025" (German format)
toDate(new Date(), {format: "YYYY-MM-DD"}) // "2025-11-12" (ISO format)
toDate(new Date(), {locale: "en", format: "DDDD, MMMM Do, YYYY"}) // "Wednesday, November 12th, 2025"
toDate(new Date(), {locale: "ar", format: "DD/MM/YYYY HH:mm"}) // "١٢/١١/٢٠٢٥ ١٤:٣٠" (Arabic numerals)
toDate(new Date(), {format: "long"}) // Uses locale's predefined long format
Formats a Date object into a localized string representation.