C Programming/time.h/localtime

localtime() is a library function in time.h. It converts calendar time into local time.

Syntax

edit
#include <time.h>
struct tm * localtime ( const time_t * ptr_time );

Parameters:

The pointer 'ptr_time' is a pointer to a 'time_t' object that contains a calendar time.

Return Value:
The function localtime() returns a pointer to a tm structure. The tm structure contains the time information.

Explanation

edit


The function localtime() uses the time pointed by the pointer ptr_time to fill a tm structure with the values that represent the corresponding local time. If this function is called, it returns the localtime in the form
"day Month date hr:min:sec year"((Output)).

References

edit