← Developer

strftime Formatter

Test strftime format strings with live preview and a complete directive reference.

Format Preview

Directive Reference

Directive Description Example
Use this tool from AI agents

This tool's engine is available to AI agents over MCP as strftime_preview. Add the Clean.tools server, then your agent can call it directly.

Claude Code
claude mcp add --transport http clean-tools https://mcp.clean.tools/mcp
Claude Desktop (mcpServers)
{"mcpServers":{"clean-tools":{"command":"npx","args":["-y","@clean-tools/mcp"]}}}
Cursor
https://mcp.clean.tools/mcp

Or call it over plain HTTP from any script. Same engine, JSON in and JSON out, no key:

curl
curl -s https://api.clean.tools/v1/strftime_preview \ -H 'content-type: application/json' \ -d '{"format":"%A, %B %e, %Y at %I:%M %p","datetime":"2026-07-07T13:45"}'
JavaScript
const res = await fetch('https://api.clean.tools/v1/strftime_preview', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ format: '%A, %B %e, %Y at %I:%M %p', datetime: '2026-07-07T13:45' }) }); const data = await res.json();

How it works

This strftime formatter lets you test date format strings with live preview. Type a format string using standard strftime directives and see the output instantly. The reference table shows all supported directives with live examples using the current date and time.

All formatting runs locally in your browser using a custom JavaScript implementation. No data is sent to a server. No cost, no signup, no tracking.

Need the same formatting from scripts or AI agents? The identical strftime_preview engine is available through the Clean.tools strftime API, or install the @clean-tools/mcp package from npm to run it as a local MCP server.

Frequently asked questions

Which time zone does the output use?

Every directive is evaluated in your browser's local time zone. %Z prints that zone's name and %z its numeric offset, so a custom date you enter is read as local time rather than UTC.

What is the difference between %U and %W?

Both number the weeks of the year from 00 to 53. %U counts Sunday as the first day of each week, while %W counts Monday first, so the two can differ by one for the same date.

Why does an unknown directive like %Q stay in the output?

Every directive in the reference table is recognized, plus the composite shortcuts %F (date as %Y-%m-%d), %T (time as %H:%M:%S), %D (%m/%d/%y), and %r (12-hour time with AM/PM). Any other percent sequence is passed through unchanged, so %Q renders as %Q. Use %% when you want a literal percent sign.

Do %c, %x, and %X look the same on every device?

No. Those three delegate to your browser's locale formatting, so the exact text depends on the visitor's language and region settings and can vary between machines.

Can I use this from the command line or an AI agent?

Yes. The same engine is exposed as a REST endpoint at https://api.clean.tools/v1/strftime_preview, so you can POST a format string and get the result back as JSON from any script. It is also an MCP server you can add to Claude, Claude Code, or Cursor, and the @clean-tools/mcp package on npm runs that same server locally over stdio.


More tools from Clean.tools

View all tools

Use Clean.tools from your AI agent

This tool is also strftime_preview on the Clean.tools MCP server — the same engine, callable by your AI agent directly. No key, no signup: requests are processed in memory and request contents are never stored.

Claude Code
claude mcp add --scope user --transport http clean-tools https://mcp.clean.tools/mcp
Any MCP client (streamable HTTP, authless)
https://mcp.clean.tools/mcp

Every tool, the REST API, and setup for Cursor, Claude Desktop, VS Code & more →