Name
strftime
Synopsis
$time = strftime($format, $time)
This converts a Unix time into a text representation of the time
using format as a guide. Any of the following
sequences in format are replaced with their
corresponding value:
- %a
Day of week, using locale’s abbreviated weekday names
- %A
Day of week, using locale’s full weekday names
- %b
Month, using locale’s abbreviated month names
- %B
Month, using locale’s full month names
- %d
Day of month (01-31)
- %D
Date as %m/%d/%y
- %e
Day of month (1-31 with single digits preceded by a space)
- %H
Hour (00-23)
- %I
Hour (00-12)
- %j
Day of year (001-366)
- %k
Hour (0-23, blank padded)
- %l
hour (1-12, blank padded)
- %m
Month number (01-12)
- %M
Minute (00-59)
- %p
AM or PM
- %S
Seconds (00-59)
- %T
Time as %H:%M:%S
- %U
Week number in year (01-52)
- %w
Day of week (0-6, Sunday being 0)
- %y
Year within the century (00-99)
- %Y
Year including century (e.g., 1999)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access