The C date and time functions are a group of functions in the
standard library
In computer programming, a standard library is the library made available across implementations of a programming language. These libraries are conventionally described in programming language specifications; however, contents of a language's as ...
of the
C programming language
''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
implementing date and time manipulation operations. They provide support for
time
Time is the continued sequence of existence and events that occurs in an apparently irreversible succession from the past, through the present, into the future. It is a component quantity of various measurements used to sequence events, to ...
acquisition, conversion between date formats, and formatted output to strings.
Overview of functions
The C date and time operations are defined in the
time.h
header file (
ctime
header in
C++).
The and related types were originally proposed by Markus Kuhn to provide a variety of time bases, but only was accepted.
The functionalities were, however, added to C++ in 2020 in std::chrono.
Example
The following C source code prints the current time to the
standard output stream.
#include
#include
#include
int main(void)
The output is:
Current time is Thu Sep 15 21:18:23 2016
See also
*
Unix time
*
Year 2038 problem
References
External links
{{CProLang, state=expanded
C standard library
Time