Convierte el tiempo t en una estructura, corregida por el tiempo local de la zona.
Devuelve un puntero a una estructura estática, struct tm, que se reescribe con cada llamada.
ANSI, POSIX
En la función main se muestra la fecha de ayer.
#include <stdio.h> #include <time.h> int main(){ const int segundosDia=60*60*24; time_t ayer, hoy=time(0); ayer=hoy-segundosDia; struct tm *pstm; pstm = localtime(&ayer); /* Se muestra la fecha de ayer */ printf("La fecha es %d/%d/%d\n",pstm->tm_mday,pstm->tm_mon+1,pstm->tm_year+1900); return 0; }