---
title: "Format dates and numbers for the reader · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/dates-numbers-and-text/locale-content
id: LOC-11
level: Recommended
updated: 2026-10-22
tokens: 993
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Format dates and numbers for the reader

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Dates, numbers and text](https://agentwranglers.se/playbook/localization/dates-numbers-and-text.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-11
- Level: Recommended
- Chapter: [Dates, numbers and text](https://agentwranglers.se/playbook/localization/dates-numbers-and-text.md)
- Rule: Format dates, numbers and money for the reader's locale with a formatting library. Show times with a named time zone.
- Check: A unit test formats a fixed date and amount for each supported locale. The output matches the expected strings.
- How: Format with an ICU-based library, such as `Intl` in JavaScript, Babel in Python, the intl extension in PHP or ICU4J in Java. Always pass a locale, and pass a time zone for dates and times. Store and send moments in UTC, as in [dates and times](https://agentwranglers.se/playbook/api-design/requests-and-responses/dates-and-times.md), and convert only for display.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
const when = new Date('2026-03-05T14:00:00Z');
new Intl.DateTimeFormat('sv-SE', { dateStyle: 'long', timeStyle: 'long', timeZone: 'Europe/Stockholm' }).format(when);
// "5 mars 2026 kl. 15:00:00 CET"
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(1234.5);
// "1.234,50 €", with a no-break space before the €
```

### Python example

```python
# Python with Babel
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
from babel.dates import format_datetime
from babel.numbers import format_currency
when = datetime(2026, 3, 5, 14, 0, tzinfo=timezone.utc)
format_datetime(when, "long", tzinfo=ZoneInfo("Europe/Stockholm"), locale="sv_SE")
# "5 mars 2026 15:00:00 CET"
format_currency(1234.5, "EUR", locale="de_DE")  # "1.234,50 €"
```

### PHP example

```php
// PHP with the intl extension
$when = new DateTimeImmutable('2026-03-05T14:00:00Z');
$dates = new IntlDateFormatter('sv_SE', IntlDateFormatter::LONG, IntlDateFormatter::LONG, 'Europe/Stockholm');
echo $dates->format($when); // "5 mars 2026 kl. 15:00:00 CET"
echo (new NumberFormatter('de_DE', NumberFormatter::CURRENCY))->formatCurrency(1234.5, 'EUR'); // "1.234,50 €"
```

## Sources

- [ECMA-402 (ECMAScript Internationalization API)](https://tc39.es/ecma402/)
- [Unicode CLDR](https://cldr.unicode.org/)

## Related rules

- APP-12 [Show times in the user's time zone](https://agentwranglers.se/playbook/app-ui/dates-and-numbers/user-time-zone.md) in Web app interface
- API-7 [Send dates as RFC 3339 with a time zone](https://agentwranglers.se/playbook/api-design/requests-and-responses/dates-and-times.md) in API design
- LOC-26 [Writing date formats by hand](https://agentwranglers.se/playbook/localization/dates-numbers-and-text/hand-written-date-patterns.md) in Localization
- LOC-32 [Send raw values with standard codes instead of formatted text](https://agentwranglers.se/playbook/localization/apis-and-data/locale-neutral-api-values.md) in Localization

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/dates-numbers-and-text/locale-content">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Writing date formats by hand](https://agentwranglers.se/playbook/localization/dates-numbers-and-text/hand-written-date-patterns.md)
- [Dates, numbers and text](https://agentwranglers.se/playbook/localization/dates-numbers-and-text.md)
