Date and Time:

The C++ programming language standard library provides many functions these include input/ output functions mathematical functions etc. But it does not have a wide range of displaying date and time.

Therefore C++ programming language inherits date and time structures or data types from C language. To use these data types the header files should be included: the header file for using date and time is as follows:

# include <ctime>

Ctime converts date and time to a string



Char *ctime(const time_t * time);

Ctime converts the time value *time into a 26 character string. The 26 character string has a form given below, and is ended with (\n) and a null character (\0) just like an array.

DDD MMM dd hh:mm:ss YYYY

Where DDD is day, MMM  is month, dd is the date, hh is hours, mm is minutes, ss are seconds and YYYY is the year.


Wed Aug 2 4: 09: 32 2016\n\0

 From this we conclude that date and time completely displays the day, month, date, hours, minutes, seconds and year in a sequence. The sequence or the format can also be changed using different functions that are built in. there are total four types to represent time in different formats. These types include; clock_t, time_t, size_t, struct tm.


Wed Aug 2 4: 09: 32 2016\n\0