staticdata.dev
Menu
Datasets About Contact

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).

v1.0.0 MIT 41 records Updated 2026-10-05 stable Source:  The Open Group Base Specifications Issue 7 (POSIX.1-2017) — strftime()

Quick fetch

Stable URL. CORS-enabled. No auth.

bash
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

    Open

    min: 3.5 KB · /v1/strftime-tokens.min.json

  • CSV 2.1 KB

    /v1/strftime-tokens.csv

    Open
  • TypeScript 4.7 KB

    /v1/strftime-tokens.ts

    export const strftimeTokens

    type StrftimeToken = (typeof strftimeTokens)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
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.

Data preview
tokenmeaningexample
%aAbbreviated weekday nameMon
%AFull weekday nameMonday
%bAbbreviated month nameJan
%BFull month nameJanuary
%cPreferred date and time representation for the current localeMon Jan 2 15:04:05 2006
%CCentury number (year / 100), zero-padded to 2 digits20
%dDay of the month, zero-padded (01–31)02
%DShort date; equivalent to %m/%d/%y01/02/06
%eDay of the month, space-padded ( 1–31) 2
%FISO 8601 date; equivalent to %Y-%m-%d2006-01-02

Showing 10 of 41. View full data:  JSON · CSV

Fetch examples

Drop-in snippets in five languages.

curl
curl -sSL https://staticdata.dev/v1/strftime-tokens.json | jq '.[0]'
JavaScript
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]);
Python
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])
Go
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])
}
Rust
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