C++ Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
C++ Tutorial
C++ Language Tutorial - Object Oriented Programing - OOPs History of C++
C++ Language Tutorial - Object Oriented Programing - OOPs Structure of C++
C++ Language Tutorial - Object Oriented Programing - OOPs C++ Datatypes
C++ Language Tutorial - Object Oriented Programing - OOPs Variables
C++ Language Tutorial - Object Oriented Programing - OOPs Constants
C++ Language Tutorial - Object Oriented Programing - OOPs Operators
C++ Language Tutorial - Object Oriented Programing - OOPs Control Structures
C++ Language Tutorial - Object Oriented Programing - OOPs Arrays
C++ Language Tutorial - Object Oriented Programing - OOPs Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Class
C++ Language Tutorial - Object Oriented Programing - OOPs Predefined Functions
C++ Language Tutorial - Object Oriented Programing - OOPs I/O Functions
C++ Language Tutorial - Object Oriented Programing - OOPs String, Character Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Mathematical Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Time Date Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Dynamic Allocation
C++ Language Tutorial - Object Oriented Programing - OOPs Utility Functions
C++ Language Tutorial - Object Oriented Programing - OOPs OOP's Concept
C++ Language Tutorial - Object Oriented Programing - OOPs Special Topics
C++ Language Tutorial - Object Oriented Programing - OOPs Type casting
C++ Language Tutorial - Object Oriented Programing - OOPs Feedback
C++ Language Tutorial - Object Oriented Programing - OOPs Ask Your Doubts
 





Time and Date Functions


Tutorials Cpp

Topic

What are Time, Date Functions in C++?



Explanation

Standard Function Library defines several functions related to Date and Time. The header file required for the date and time functions is "<ctime>" or "<time.h>".

This header file defines three time related types clock_t, time_t and tm. The first two types represent the system time and date as an integer value. But the structure type "tm" holds the date time values individually like second, minute etc. This "ctime" header also defines a macro "CLOCKS_PER_SEC" which is the number of ticks of the system clock per second.

The geopolitical functions are also combined with the time and date function using the header "<clocale.h>.

Following table lists few Time, Date of C++ Standard function Library.

Name Description
asctime Converts the contents of a structure into the format "day month date hours:minutes:seconds year."
clock Returns the amount of time in milliseconds, the calling programm is running.
ctime Converts the "time_t" object pointed by the pointer "ptr" to return localtime.
difftime
gmtime Returns a pointer in the "tm" in broken time format.
localeconv
localtime Returns a pointer to the broken down time using the "tm" structure.
mktime Returns the calendar time equivalent of the broken down structure pointed by "time".
setlocale
strftime Inserts the time and date, other information into the string pointed by "str", according to the specified format.
time Returns the current calendar time of the system.









Other Links

web hosting