Skip to content

Token Specification & Cross-Ecosystem Matrix ​

This document provides a comprehensive cross-reference matrix comparing date formatting and parsing tokens across Native Tempo Core and nine major ecosystem dialects:

  • Unicode LDML / UTS #35 (ldml – date-fns, Luxon, CLDR)
  • Moment.js / Day.js (moment – Day.js, Moment)
  • POSIX strftime (strftime – C, Python datetime, Ruby, Linux)
  • .NET / C# (dotnet – C#, PowerShell, ASP.NET)
  • Excel / Google Sheets (sheet – Spreadsheets, Calc)
  • MySQL / MariaDB (mysql – DATE_FORMAT, STR_TO_DATE)
  • Oracle / PostgreSQL (oracle – TO_CHAR, TO_DATE, Snowflake)
  • PHP date() (php – Laravel, WordPress, Symfony)
  • Go time.Format (go – Golang reference layouts)

1. Interactive Dialect Token Navigator ​

Select a dialect tab below to view all supported specifiers, their Native Tempo equivalents, copyable tags, and live code examples. Use the filter bar to quickly locate tokens by keyword (e.g., year, hour, ord, fractional, timezone).

TypeScript Quick Example
// Parse:Tempo.fromFormat('2026-10-24 15:30:45.123', 'yyyy-MM-dd HH:mm:ss.fff', { dialect: 'dotnet' })// Format:t.format('dddd, MMMM d, yyyy HH:mm:ss K', { dialect: 'dotnet' })
Showing 32 of 32 tokens
.NET / C# TokenNative Tempo EquivalentCategoryDescription & Output Sample
yyyyYear
4-digit calendar year
Sample: 2026
yyyyyYear
5-digit zero-padded year
Sample: 02026
yyYear
2-digit year (00–99)
Sample: 26
yYear
Unpadded year (0–99)
Sample: 26
MMMMMonth
Full month name
Sample: October
MMMMonth
Abbreviated month name
Sample: Oct
MMMonth
Zero-padded month (01–12)
Sample: 10
MMonth
Unpadded month (1–12)
Sample: 10
ddddWeekday
Full weekday name
Sample: Saturday
dddWeekday
Abbreviated weekday name
Sample: Sat
ddDay
Zero-padded day of month (01–31)
Sample: 24
dDay
Unpadded day of month (1–31)
Sample: 24
HHHour
Zero-padded 24-hour (00–23)
Sample: 15
HHour
Unpadded 24-hour (0–23)
Sample: 15
hhHour
Zero-padded 12-hour (01–12)
Sample: 03
hHour
Unpadded 12-hour (1–12)
Sample: 3
mmMinute
Zero-padded minute (00–59)
Sample: 30
mMinute
Unpadded minute (0–59)
Sample: 30
ssSecond
Zero-padded second (00–59)
Sample: 45
sSecond
Unpadded second (0–59)
Sample: 45
fffffffFractional
100-nanosecond ticks (7 digits)
Sample: 1234567
ffffffFractional
Microseconds (6 digits)
Sample: 123456
fffFractional
Milliseconds (3 digits)
Sample: 123
ttHour
AM / PM designator
Sample: PM
tHour
A / P marker
Sample: P
zzzTimezone
Hours and minutes offset with colon
Sample: +08:00
zz / zTimezone
Signed hour offset
Sample: +08
KTimezone
ISO 8601 offset representation (Z for UTC)
Sample: +08:00
O / oOther
Standard Round-trip ISO-8601 specifier
Sample: 2026-10-24T15:30:45.1234567+08:00
Standard .NET composite format specifier
sOther
Standard Sortable ISO specifier
Sample: 2026-10-24T15:30:45
Standard .NET composite format specifier
uOther
Universal sortable pattern
Sample: 2026-10-24 15:30:45Z
Standard .NET composite format specifier
r / ROther
RFC 1123 format specifier
Sample: Sat, 24 Oct 2026 15:30:45 GMT
Standard .NET composite format specifier

2. Core Standards Comparison Matrix ​

For a high-level overview across the most common date-formatting paradigms, the table below highlights primary date and time components compared to Native Tempo:

ComponentDescriptionLDML / date-fnsMoment / Day.jsPOSIX strftime.NET / C#Native Tempo
Year (4-digit)4-digit calendar year (2026)yyyyYYYY%Yyyyy{yyyy}
Year (2-digit)2-digit calendar year (26)yyYY%yyy{yy}
Week-Numbering YearWeek-numbering year (ISO via %G / GGGG; locale-dependent in LDML YYYY)YYYY*GGGG%GN/A{yow}
Month (padded)Zero-padded month (01–12)MMMM%mMM{mm}
Month (raw)Unpadded month (1–12)MM%-m*M{mm:raw}
Month Name (short)Abbreviated month (Oct)MMM / LLLMMM%bMMM{mmm}
Month Name (full)Full month name (October)MMMM / LLLLMMMM%BMMMM{mon}
Day (padded)Zero-padded day (01–31)ddDD%ddd{dd}
Day (raw)Unpadded day (1–31)dD%-d*d{dd:raw}
Day (ordinal)Ordinal suffix (24th)N/ADoN/AN/A{dd:ord}
Day of YearDay of year (001–366)DDDDDDD%jN/A{doy}
Week of YearWeek number (01–53; ISO via %V / WW; locale-dependent in LDML ww)ww*WW%VN/A{woy}
Weekday (full)Full weekday (Saturday)EEEEdddd%Adddd{wkd}
Weekday (short)Abbreviated weekday (Sat)EEEddd%addd{www}
Weekday (numeric)Numeric weekday (ISO 1=Mon..7=Sun via %u/E; locale-dependent 1-7 in LDML e/c)e / c*E%uN/A{dow}
Hour (24h padded)24-hour clock (00–23)HHHH%HHH{hh}
Hour (24h raw)24-hour clock unpadded (0–23)HH%-H*H{hh:raw}
Hour (12h padded)12-hour clock (01–12)hhhh%Ihh{h12}
Hour (12h raw)12-hour clock unpadded (1–12)hh%-I*h{h12:raw}
Meridiem (upper)Uppercase indicator (AM / PM)aaA%ptt{mer:upper}
Minute (padded)Zero-padded minute (00–59)mmmm%Mmm{mi}
Second (padded)Zero-padded second (00–59)ssss%Sss{ss}
Milliseconds3-digit fractional seconds (123)SSSSSS%3f*fff{ms}
Microseconds6-digit fractional seconds (123456)SSSSSSSSSSSS*%f*ffffff{ff:6}
Timezone OffsetFixed offset with colon (+08:00)ZZZZZ / XXXZN/Azzz{tz:offset}
Timezone (Kind-based)Dynamic offset or Z based on DateTime.KindN/AN/AN/AK*{tz:offset:utc}
Compact OffsetPortable offset without colon (+0800)ZZZZ%zN/A{tz:offset:compact}
Timezone AbbreviationLocalized abbreviation (CET)zz%ZN/A{tz:short}
Unix EpochSeconds since Unix epochN/AX%s*N/A{ts}

NOTE

* Standard Variations & Extensions:

  • LDML (YYYY, ww, e, c): In Unicode UTS #35, week-numbering year, week of year, and numeric day of week reflect territory/locale calendar conventions; deterministic ISO 8601 behavior requires explicit ISO settings.
  • Moment / Day.js (SSSSSS): Moment formats up to 3 fractional digits (milliseconds) and zero-pads additional digits; standard Day.js only formats up to SSS without plugins.
  • POSIX strftime (%-m, %-H, %-I, %f, %s): Modifiers omitting padding (%-) and %s (seconds since Unix epoch) are GNU/BSD extensions not specified in the standard POSIX strftime specification; %z is the POSIX portable standard for compact offsets. POSIX does not specify subseconds; %f is Python's 6-digit microsecond specifier, while %3f, %6f, and %9f are Tempo extensions.
  • .NET K: Unlike fixed-offset zzz (+08:00), K produces an offset for DateTimeKind.Local, Z for DateTimeKind.Utc, and an empty string for DateTimeKind.Unspecified.

3. Literal Text Escaping Rules ​

When embedding plain text inside masks, each dialect implements distinct escaping conventions:

A. Unicode LDML & Luxon (ldml) ​

  • Enclose text in single quotes: 'Date: ' yyyy-MM-dd.
  • To emit a literal single quote, use two consecutive single quotes: ''yyyy'' → '2026'.
typescript
const str = t.format("'Report generated on' yyyy-MM-dd 'at' HH:mm", { dialect: 'ldml' });
// => "Report generated on 2026-10-24 at 15:30"

B. Moment.js & Day.js (moment) ​

  • Enclose text in square brackets: [Report generated on] YYYY-MM-DD.
  • Bare characters outside tokens remain literal text.
typescript
const str = t.format('[Invoice #] YYYY-MM-DD [due by] HH:mm', { dialect: 'moment' });
// => "Invoice # 2026-10-24 due by 15:30"

C. POSIX strftime & MySQL (strftime, mysql) ​

  • Characters not prefixed by % are treated as literal text.
  • To emit a literal percent symbol, use %%: %% %Y-%m-%d → % 2026-10-24.
typescript
const str = t.format('%% Processed at %Y-%m-%d %H:%M:%S %%', { dialect: 'strftime' });
// => "% Processed at 2026-10-24 15:30:45 %"

D. .NET / C# (dotnet) ​

  • Enclose text in single quotes 'text' or double quotes "text".
  • Escape individual characters using a backslash \.
typescript
const str = t.format("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff", { dialect: 'dotnet' });
// => "2026-10-24T15:30:45.123"

E. Excel / Google Sheets (sheet) ​

  • Enclose arbitrary strings in double quotes: "Order Date: " yyyy-mm-dd.
  • Escape individual characters using backslash \.
  • Formatting decorators like _ (space reservation) and * (fill character) are ignored in standard parsing/formatting.
typescript
const str = t.format('"Total: $0.00 as of " mmmm d, yyyy', { dialect: 'sheet' });
// => "Total: $0.00 as of October 24, 2026"

F. Native Tempo Core ​

  • In Native Tempo syntax, tokens are enclosed in curly braces {token}. Everything outside braces is literal text by default.
  • To emit a literal { or }, use {{ or }}:
typescript
const str = t.format('Total balance: ${0} as of {yyyy}-{mm}-{dd}', { dialect: null });
// => "Total balance: $0 as of 2026-10-24"

4. Ecosystem-Specific Nuances ​

A. Context-Sensitive mm in Spreadsheets ​

In spreadsheet software (Excel, Google Sheets, Calc), the mask m or mm represents:

  • Minutes when immediately preceded by an hour (h or hh) or immediately followed by a second (s or ss), such as hh:mm:ss.
  • Months everywhere else, such as yyyy-mm-dd or mm/dd/yyyy.

Tempo's sheet dialect automatically inspects token neighbors during tokenization to guarantee accurate resolution without manual intervention.

B. Standard .NET Single-Character Specifiers ​

In .NET, single-letter format strings expand into standard system patterns:

  • O or o: Round-trip ISO-8601 (yyyy-MM-ddTHH:mm:ss.fffffffK)
  • s: Sortable date/time (yyyy-MM-ddTHH:mm:ss)
  • u: Universal sortable (yyyy-MM-dd HH:mm:ssZ)
  • r or R: RFC 1123 (ddd, dd MMM yyyy HH:mm:ss GMT)
  • d / D: Short / Long date
  • t / T: Short / Long time

Tempo compiles these specifiers directly into optimal matching pipelines.

C. Hour Normalization (24:00 Midnight) ​

When parsing 24-hour clocks, differing standards support 00-23 (HH, H) and 01-24 (kk, k):

  • In Unicode LDML and Moment, kk indicates hours from 01 to 24. Hour 24:00 represents midnight at the close of day, which Temporal engines normalize to 00:00.
  • The Dialects parser safely normalizes 24:00 to hour 0, while strictly rejecting out-of-range hours like 25:00 or 00:00 for kk tokens:
typescript
const validMidnight = Tempo.fromFormat('2026-10-24 24:00', 'yyyy-MM-dd kk:mm');
console.log(validMidnight.hh); // 0 (normalized)

const invalidHour = Tempo.fromFormat('2026-10-24 25:00', 'yyyy-MM-dd kk:mm', { error: 'catch' });
console.log(invalidHour.isValid); // false

Released under the MIT License.