Computing

strftime Output Calculator

Preview the output of strftime date/time formatting strings in real-time.

Formatted Output

Loading...

Also try Days Between Dates Calculator Business Days Between Dates Calculator Business Days From Today

How to Use

  1. Type your strftime format string into the input field
  2. The formatted current time will appear instantly below
  3. Click any example button to try common format patterns

Dates

  • %a - Abbreviated weekday name (“Sun”)
  • %A - Full weekday name (“Sunday”)
  • %b - Abbreviated month name (“Jan”)
  • %B - Full month name (“January”)
  • %d - Day of the month (01..31)
  • %e - Day of the month without leading zero (1..31)
  • %j - Day of the year (001..366)
  • %m - Month of the year (01..12)
  • %U - Week number, Sunday-based (00..53)
  • %W - Week number, Monday-based (00..53)
  • %w - Day of the week (Sunday is 0, 0..6)
  • %x - Preferred date representation
  • %y - Year without century (00..99)
  • %Y - Year with century

Times

  • %H - Hour, 24-hour clock (00..23)
  • %I - Hour, 12-hour clock (01..12)
  • %l - Hour, 12-hour clock, no leading zero (1..12)
  • %M - Minute (00..59)
  • %N - Fractional seconds digits
  • %P - Meridian indicator (“am” or “pm”)
  • %p - Meridian indicator (“AM” or “PM”)
  • %S - Second (00..60)
  • %X - Preferred time representation
  • %Z - Time zone name

Misc

  • %c - Preferred local date and time representation
  • %% - Literal “%” character

About strftime Output Calculator

A free online strftime tester. Type a format string such as %Y-%m-%d %H:%M:%S and see straight away what it prints, using the current date and time. Use it to build a format, check a code you are unsure of, or work out the strftime format for a date you are looking at.

Test a strftime format string online

Type or paste your format into the box and the output updates as you type. Click any of the example buttons to load a common pattern and change it from there. It is quicker than running a script every time you move a %d.

Common strftime formats

  • %Y-%m-%d gives an ISO date, like 2026-02-18
  • %Y-%m-%dT%H:%M:%SZ gives an ISO 8601 timestamp, like 2026-02-04T22:30:00Z
  • %Y-%m-%d %H:%M:%S gives a date and 24-hour time, like 2026-02-18 10:00:43
  • %d/%m/%Y gives day first, like 26/11/2020
  • %I:%M %p gives a 12-hour time with AM or PM, like 10:30 PM
  • %a, %d %b %Y gives a short readable date, like Wed, 18 Feb 2026
  • %A %B %e, %Y gives a long readable date, like Wednesday February 18, 2026

12-hour and 24-hour time

Use %H for the hour on a 24-hour clock (00 to 23) and %I for the hour on a 12-hour clock (01 to 12), with %p for AM or PM. %H never prints 24: midnight is 00.

Why use it

  • Instant Visualization: See exactly how your date/time format will appear without writing and running test code
  • Time-Saving: Choose from pre-configured common formats or create custom patterns with immediate feedback
  • Error Reduction: Quickly identify and fix formatting issues before implementing in production code
  • All the standard codes: every strftime code for dates, times and timezone formatting

Works for Ruby, Python, PHP, C and more

strftime codes are shared by most programming languages and by tools such as date on Linux, so a format you test here will work in Ruby, Python, PHP, C, Go templates that use strftime, and many databases and logging tools. A few codes differ between platforms, so test any unusual ones in your own environment too.

FAQ

What is strftime?

strftime is a function found in many programming languages that converts date and time values into formatted strings using percent codes (like %Y for year).

Which format codes are supported?

All standard strftime codes are supported, including date components (%d, %m, %Y), time elements (%H, %M, %S), and localization options (%a, %A, %b, %B).

Can I see how the format will look in different timezones?

The tool displays results in your current timezone. The %Z format code will show your local timezone abbreviation.

How often does the preview update?

The formatted output updates in real-time as you type and refreshes every second to keep the time current.

Can I use this for different programming languages?

Yes, the strftime format is relatively standard across many languages including Python, Ruby, PHP, and C. Small variations may exist between implementations.

What is the strftime format for an ISO 8601 date?

%Y-%m-%dT%H:%M:%S gives 2026-02-18T10:00:43. Add %z for the offset or a literal Z for UTC.

How do I show 12-hour time in strftime?

Use %I:%M %p, which prints a time like 10:30 PM.

Is the strftime tester free?

Yes. It is free, runs in your browser and needs no sign-up.