Format dates using strftime()

Many popular languages support strftime()-style format strings when converting datestimes to strings. Instead of viewing man pages and building your format string via trial-and-error, this tool helps get you up and running quickly with a concrete and accurate format string.

Enter the source datetime in the first box, and strftime() format string in the second. The formatted string will update automatically.

Code Example Meaning


%A Full weekday name
%a Abbreviated weekday name
%B Full month name
%b Abbreviated month name
%C Zero-padded AD century (year / 100)
%D Equivalent to '%m/%d/%y'
%d Zero-padded day of month
%e Space-padded day of month
%F Equivalent to '%Y-%m-%d'
%h Same as %b
%j Zero-padded day of year
%m Zero-padded month
%o Ordinal day of month
%U Zero-padded week number of year 2
%u Weekday 3
%v Equivalent to '%e-%b-%Y'
%W Zero-padded week number of year 3
%w Weekday 2
%Y Full year
%y Abbreviated year
Code Example Meaning


%H Zero-padded 24-hour hour
%I Zero-padded 12-hour hour
%k Space-padded 24-hour hour
%L Zero-padded milliseconds 1
%l Space-padded 12-hour hour
%M Zero-padded minute
%P Lowercase am/pm 1
%p Uppercase AM/PM
%R Equivalent to '%H:%M'
%r Equivalent to '%I:%M:%S %p'
%S Zero-padded seconds
%s Seconds since Epoch (UTC)
%T Equivalent to '%H:%M:%S'
%Z Time zone name 4
%z Time zone offset from UTC 5


%n Newline character (\n)
%t Tab character (\t)
%% Percent character (%)
  1. Non-standard extension
  2. Sunday as the first day of the week
  3. Monday as the first day of the week
  4. Replaced with empty string if not found
  5. Prefixed with '+' for zones east of UTC and '-' for zones west. Hours and minutes are zero-padded to 2-digits and no dlimiter separates them
JavaScript strftime() implementation from Sami Samhuri's strftime.js. While many programming languages that implement the standard C strftime, some differences may appear on your target platform, other than those noted here. Check your target implementation and platform to be sure.