mktime function(Convert to Calendar Time) in C Language – example and detail

In the C Programming Language, the mktime characteristic converts a broken-down nearby time (pointed to by way of timeptr) and returns a pointer to a calendar time.


The syntax for the mktime feature in the C Language is:

time_t mktime(struct tm *timeptr);

Parameters or Arguments

timeptr A pointer to a structure that contains a broken-down neighborhood time to convert.


The mktime function returns a calendar time that describes a broken-down nearby time pointed to via timeptr.

If there is an error, the mktime feature will return -1.

Required Header

In the C Language, the required header for the mktime function is:

#include <time.h>

Applies To

In the C Language, the mktime characteristic can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the mktime function:

asctime feature ctime feature difftime function gmtime characteristic localtime feature strftime characteristic time feature