Home

tmwday

tmwday is a term used in programming to refer to the weekday component of a broken-down time representation. In many C-family environments, the formal name for this value is tm_wday, a member of the standard struct tm defined in time.h. The shorthand tmwday is often seen in documentation or code discussions as a convenient alias or variable name for this field.

In the canonical C and POSIX implementations, tm_wday is an integer ranging from 0 to 6, where

tm_wday is typically valid for any calendar time within the proleptic Gregorian calendar and reflects the day

Usage typically involves obtaining a struct tm via localtime or gmtime, then reading the tm_wday field to

0
represents
Sunday,
1
Monday,
and
so
on
through
Saturday
(6).
This
convention
is
tied
to
the
way
time
is
broken
down
by
functions
such
as
localtime
and
gmtime,
which
convert
a
time_t
timestamp
into
a
calendar
decomposition
that
includes
tm_wday,
tm_yday
(day
of
the
year),
and
the
hour,
minute,
and
second
components.
of
the
week
for
the
corresponding
locale’s
interpretation
of
that
time.
It
does
not
encode
time
zone
information
itself;
that
context
is
provided
by
the
original
time_t
value
and
the
subsequent
use
of
localtime
or
gmtime.
determine
the
day
of
the
week
for
that
timestamp.
Related
fields
include
tm_yday
(day
of
the
year)
and
the
time
components
tm_hour,
tm_min,
and
tm_sec.
In
C++,
std::tm
exposes
the
same
member
tm_wday
as
part
of
the
standard
time
facilities.