π Date Formatter
A powerful, flexible date formatting formula for Nordcraft.
π Installation
formatDateFormulasPackage Formulas
π Overview
formatDate
- Multiple presets
- Custom format strings
- Internationalization
- Timezone support
- Smart auto-formatting
π₯ Inputs
| Input | Type | Default | Description |
|---|---|---|---|
| date | String | (now) | Date to format (ISO string, timestamp, or Date object) |
| format | String | "auto" | Preset or custom format string (see presets below) |
| locale | String | "en-US" | Language/locale (e.g., 'en-US', 'fr-FR', 'es-ES') |
| timeZone | String | "UTC" | Timezone (e.g., 'UTC', 'America/New_York', 'Europe/London') |
π Format Presets
format
| Preset | Example Output |
|---|---|
| "iso" | 2026-07-24T14:30:00.000Z |
| "date" | July 24, 2026 |
| "date-short" | 2026-07-24 |
| "date-slashed" | 07/24/2026 |
| "date-eu" | 24/07/2026 |
| "time" | 14:30:00 |
| "time-12" | 2:30:00 PM |
| "datetime" | Jul 24, 2026 14:30 |
| "datetime-12" | Jul 24, 2026 2:30 PM |
| "full" | July 24, 2026 at 14:30:00 UTC |
| "full-12" | July 24, 2026 at 2:30:00 PM UTC |
| "relative" | 2 days ago |
| "month" | July |
| "month-short" | Jul |
| "day" | Friday |
| "day-short" | Fri |
| "year" | 2026 |
| "timestamp" | 1721821800000 |
| "auto" | Automatically chooses the best format |
π§ Custom Format Tokens
Create your own format by combining these tokens in any order. The formula replaces each token with the actual value.
| Token | Meaning | Example |
|---|---|---|
| YYYY | Full year (4-digit) | 2026 |
| YY | Short year (2-digit) | 26 |
| MMMM | Full month name | July |
| MMM | Short month name | Jul |
| MM | Month (2-digit) | 07 |
| M | Month (1-12) | 7 |
| DDDD | Full day name | Friday |
| DDD | Short day name | Fri |
| DD | Day (2-digit) | 24 |
| D | Day (1-31) | 24 |
| HH | Hour (24-hour, 2-digit) | 14 |
| H | Hour (24-hour, 0-23) | 14 |
| hh | Hour (12-hour, 2-digit) | 02 |
| h | Hour (12-hour, 1-12) | 2 |
| mm | Minute (2-digit) | 30 |
| m | Minute (0-59) | 30 |
| ss | Second (2-digit) | 00 |
| s | Second (0-59) | 0 |
| SSS | Millisecond (3-digit) | 123 |
| A | AM/PM (uppercase) | PM |
| a | AM/PM (lowercase) | pm |
| Z | Timezone offset | +00:00 |
| z | Timezone abbreviation | UTC |
| W | Day of week (0-6) | 5 |
| ww | Week number | 30 |
| Q | Quarter (1-4) | 3 |
π‘ Usage Examples
Example 1: Auto Format (Smart)
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'auto'
}
Output:"Jul 24, 2026 14:30"
Example 2: ISO Format
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'iso'
}
Output:"2026-07-24T14:30:00.000Z"
Example 3: Custom Format
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'YYYY-MM-DD HH:mm:ss'
}
Output:"2026-07-24 14:30:00"
Example 4: Relative Time
Input:
{
date: '2026-07-22T14:30:00.000Z',
format: 'relative'
}
Output:"2 days ago""in 2 days"
Example 5: French Locale
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'full',
locale: 'fr-FR',
timeZone: 'Europe/Paris'
}
Output:"24 juillet 2026 Γ 16:30:00"
Example 6: Custom with Timezone
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'DDD, MMM D, YYYY at h:mm A',
timeZone: 'America/New_York'
}
Output:"Fri, Jul 24, 2026 at 10:30 AM"
Example 7: Just Date (Short)
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'date-short'
}
Output:"2026-07-24"
Example 8: 12-Hour Time
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'time-12'
}
Output:"2:30:00 PM"
Example 9: Day and Month Only
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'DDDD, MMMM DD'
}
Output:"Friday, July 24"
Example 10: Quarter and Year
Input:
{
date: '2026-07-24T14:30:00.000Z',
format: 'Q QTR, YYYY'
}
Output:"3 QTR, 2026"
Date Formatter
Supports all locales, timezones, and custom formats.