strftime (SunOS) strftime (SunOS)
NAME
strftime - Converts a date and time structure variable to a string
SUN OS SYNOPSIS
#include <time.h>
size_t strftime(
char *s,
int maxsize,
char *format,
struct tm *timeptr);
DIGITAL UNIX SYNOPSIS
#include <time.h>
size_t strftime(
char *s,
size_t maxsize,
const char *format,
const struct tm *timeptr);
PARAMETERS
Points to the array containing the output date and time string. Speci‐
fies the maximum number of bytes or wide characters to be written to
the array pointed to by the s or wcs parameter. Points to a sequence
of format codes that specify the format of the date and time to be
written to the output string or wide-character string. See the
DESCRIPTION section for more information. Points to a type tm struc‐
ture that contains broken-down time information. Points to the wide-
character array containing the output date and time string.
DIFFERENCES
Datatypes have changed
The following show which format codes are supported in Digital UNIX:
-------------------------------------------------------------
SunOS Digital Description
UNIX-------------------------------------------------------------
% % The % (percent) character is output.
a a The short day of the week is output
as a string as defined for the
current locale (Mon, for example).
A A The long day of the week is output
as defined for the current locale
(Monday, for example).
B B The long month is output as a string
as defined for the current locale
(January,for example).
b b The short month is output as a
string as defined for the current
locale(Jan, for example).
c c The date and time is output with the
default date and time as defined for
the current locale.
C C The century is output as a decimal
number in the range 00 to 99.
d d The day of the month is output as
a number between 01 and 31.
D D The format is fixed to return
%m/%d/%y. (For example, 20 Jun 1990
will return 06/20/90.)
e e The day of the month is output as a
number between 1 and 31 in a 2-digit
field with leading space fill.
Ec Specifies the locale's alternative
appropriate date and time
representation.
EC Specifies the name of the base year
(period) in the locale's alternative
representation.
Ex Specifies the locale's alternative
date representation.
EX Specifies the locale's alternative
time representation.
Ey Specifies the offset from %EC (year
only) in the locale's alternative
representation.
EY Specifies the full alternative year
representation.
H H The hour of the day is output as a
number between 00 and 23.
h h Same as b.
I I The hour of the day is output as a
number between 01 and 12.
j j The Julian day of the year is output
as a number between 001 and 366.
k Hour (0-23; single digits are
preceded by a blank)
l Hour (1-12; single digits are
preceded by a blank)
m m The month of the year is output as
a number between 01 and 12.
M M The minute is output as a number
between 00 and 59.
n n Only a newline character is output.
N The locale-dependent Emperor/Era
nameis output.
o The locale-dependent Emperor/Era
yearis output.
Od Specifies the day of the month
using the locale's alternative
numeric symbols.
Oe Specifies the day of the month
using the locale's alternative
numeric symbols.
OH Specifies the hour (24-hour clock)
using the locale's alternative
numeric symbols.
OI Specifies the hour (12-hour clock)
using the locale's alternative
numeric symbols.
Om Specifies the month using the
locale's alternative numeric
symbols.
OM Specifies the minutes using the
locale's alternative numeric
symbols.
OS Specifies the seconds using the
locale's alternative numeric
symbols.
Ou Specifies the weekday as a number
in the locale's alternative
representation (Monday=1).
OU Specifies the week number of the
year (Sunday as the first day of
the week) using the locale's
alternative numeric symbols.
OV Specifies the week number of the
year (Monday as the first day of
the week, rules corresponding to
%V), using the locale's
alternative numeric symbols.
Ow Specifies the week day as a number
in the locale's alternative
representation (Sunday = 0).
OW Specifies the week number of the
year (Monday as the first day of
the week) using the locale's
alternative numeric symbols.
Oy Specifies the year (offset from
%C) in alternative representation.
p p The AM or PM indicator is output
as a string specified for the
current locale.
r r The time in AM/PM notation is
output, according to British/US
conventions (%I:%M:%S [AM|PM]).
R R The time in hours (24-hour clock)
and minutes (%H:%M).
S S The second is output as a number
between 00 and 61.
t t Only a tab character is output.
T T The time is output as %H:%M:%S.
u Specifies the weekday as a decimal
number [1,7], with 1 representing
Monday.
U U The week number of the year
(Sunday as the first day of the
week). Output format is a decimal
number between 0 and 53.
V The week number of the year
(Monday as the first day of the
week). Output format is a decimal
number between 1 and 53. If the
week containing January 1 has four
or more days in the new year, then
it is considered week 1; otherwise,
it is week 53 or the previous year,
and the next weekis week 1.
w w The day of the week is output as a
number between 0 (Sunday) and 6.
W W The week number of the year
(Monday as the first day of the
week). Output format is a decimal
number between 0 and 53.
x x The short date is output in the
format specified for the current
locale.
X X The time is output in the format
specified for the current locale.
y y The year is output as a number
(without the century) between 00
and 99.
Y Y The year is output as a number
(with the century) between 0000
and 9999.
Z Z The (standard time or daylight
saving time) time zone name or
abbreviation is output as a string
from the environment variable TZ
(CDT, for example). If no time
zone information exists, no
characters are output.
------------------------------------------------------------
RELATED INFORMATION
Digital UNIX Functions:
strftime(3) delim off
strftime (SunOS)