strftime Format Tokens
Every conversion specifier defined by the C standard (ISO/IEC 9899) and POSIX for the strftime() function, plus the widely-supported extensions %k, %l, %P and %s present in glibc and BSD libc. Each record carries the two-character token, a plain-English description of what it formats, and a concrete example output using the reference date 2006-01-02 15:04:05 UTC (Monday).
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/strftime-tokens.json
Or use as a typed import:
import { strftimeTokens } from "https://staticdata.dev/v1/strftime-tokens.ts"
Formats
- JSON 4.5 KB
/v1/strftime-tokens.json
min: 3.5 KB · /v1/strftime-tokens.min.json
- CSV 2.1 KB
/v1/strftime-tokens.csv
- TypeScript 4.7 KB
/v1/strftime-tokens.ts
export const strftimeTokens
type StrftimeToken = (typeof strftimeTokens)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| token | string | The format token including the leading % (e.g. %Y) | %Y |
| meaning | string | Plain-English description of what the token formats | Year with century (e.g. 2006) |
| example | string | Representative output using reference date 2006-01-02 15:04:05 UTC | 2006 |
Preview
First 10 records.
| token | meaning | example |
|---|---|---|
| %a | Abbreviated weekday name | Mon |
| %A | Full weekday name | Monday |
| %b | Abbreviated month name | Jan |
| %B | Full month name | January |
| %c | Preferred date and time representation for the current locale | Mon Jan 2 15:04:05 2006 |
| %C | Century number (year / 100), zero-padded to 2 digits | 20 |
| %d | Day of the month, zero-padded (01–31) | 02 |
| %D | Short date; equivalent to %m/%d/%y | 01/02/06 |
| %e | Day of the month, space-padded ( 1–31) | 2 |
| %F | ISO 8601 date; equivalent to %Y-%m-%d | 2006-01-02 |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/strftime-tokens.json | jq '.[0]' import type { StrftimeToken } from "https://staticdata.dev/v1/strftime-tokens.ts";
const res = await fetch("https://staticdata.dev/v1/strftime-tokens.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const strftimeTokens: StrftimeToken[] = await res.json();
console.log(strftimeTokens[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/strftime-tokens.min.json") as r:
strftimeTokens = json.load(r)
print(strftimeTokens[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/strftime-tokens.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/strftime-tokens.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
The dataset covers 41 tokens: the 37 conversion specifiers defined by the C standard (ISO/IEC 9899:2018 §7.27.3.5) and POSIX.1-2017 (including %e, %g, %G and %h), plus the widely-supported extensions %k, %l, %P, and %s. The E and O modifiers (e.g. %Ec, %Oy) are not listed separately. Tokens are sorted alphabetically by the letter following %, with %% (literal percent) placed last.
Example values use the canonical Go reference time — Monday, January 2, 2006, 15:04:05 UTC — which exercises all numeric fields with distinct, non-ambiguous values. Locale-dependent tokens (%a, %A, %b, %B, %c, %p, %P, %x, %X) are shown using the POSIX/C locale (English).
The %s specifier (Unix timestamp) was not in POSIX.1-2017 but was added in POSIX.1-2024, and is implemented by all major libc versions (glibc, musl, BSD libc, macOS). The %k and %l specifiers are extensions supported by glibc and the BSDs; %P is a glibc-only extension (macOS/BSD libc do not support it). Developers targeting strictly conforming POSIX programs should prefer %H over %k and %I over %l.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
strftime-tokens changelog for this dataset's history.
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-properties
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors