Name
strftime() — Decode time string into any format
Common Usage
strftime(format
,timestring
,modifier1
,modifier2
, ... )
Description
The strftime()
function returns a formatted string
by taking a
(with modifiers) and formating it according to
timestring
, a format
printf()
style
format specification. If any of the parameters are in an
incorrect or illegal format, a NULL is returned.
The
string can contain any of the following
markers:format
%d
— day of the month (DD
%f
— seconds with fractional part (
), 00-59 plus decimal portionSS
.sss
%H
— hour (HH
%j
— day of the year (NNN
%J
— Julian Day number (
)DDDDDDD
.ddddddd
%m
— month (MM
%M
— minute (MM
%s
— seconds since 1970-01-01 (Unix epoch)%S
— seconds (SS
%w
— day of the week (N
%W
— week of the year (WW
%Y
— year (YYYY
%%
— a literal%
The
value can be in any of these formats:timestring
YYYY
-MM
-DD
YYYY
-MM
-DD
HH
:MM
YYYY
-MM
-DD
HH
:MM
:SS
YYYY
-MM
-DD
HH
:MM
:SS
.sss
YYYY
-MM
-DD
THH
:MM
YYYY
-MM
-DD
THH
:MM
:SS
YYYY
-MM
-DD
THH
:MM
:SS
.sss
HH
:MM
HH
:MM
:SS
HH
:MM
:SS
.sss
now
DDDDDDD
DDDDDDD
.ddddddd
All hour values use a 24-hour clock.
Any value that is not given will be implied. Any implied hour,
minute, second, or subsecond is zero. Any implied month or day
of month is 1. Any implied year is 2000. The full date and time
formats allow either a space or a literal uppercase T
between the date and time. The last two values (a single, large integer ...
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.