Home > Electronics Tutorials > C Language Tutorial > time.h - localtime

C Language Programming Library Reference Guide

time.h - localtime

Declaration: struct tm *localtime(const time_t *timer); The value of timer is broken up into the structure tm and expressed in the local time zone.

A pointer to the structure is returned.

Example:

#include<time.h>
#include<stdio.h>

int main(void)
{
  time_t timer;

  timer=time(NULL);
  printf("The current time is %s.\n",asctime(localtime(&timer)));
  return 0;
}
Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......