mktime() function in C++ STL
The mktime() is an inbuilt C++ function which converts the local calendar time to the time since epoch and returns the value as an object of type time_t.
time_t mktime( struct tm *time_ptr )
Parameters: The function accepts a mandatory parameter pointer time_ptr that points to a tm object structure that contains a calendar time which is to be converted.
Return Value: The function returns two type of values as described below:
- It returns the time since epoch as an object of type time_t if the parameter passed is a success.
- It returns -1 on failure.
Below program illustrates the mktime() function:
The Day on 18th June 2018 was Monday