Admin Admin
Nombre de messages : 138 Age : 38 Date d'inscription : 02/09/2006
| Sujet: Utilisation de mktime Jeu 5 Oct - 14:10 | |
| - Code:
-
#include <stdio.h> #include <time.h>
int main (void) { char *jour[]= {"dimanche", "lundi","mardi","mercredi","jeudi","vendredi","samedi"}; int y, m, d; struct tm t; time_t tt;
/* 17/04/2003*/ y = 103; /* 2003-1900 */ m = 4; d = 17; t.tm_sec = 0; t.tm_min = 0; t.tm_mday = d; t.tm_mon = m; t.tm_year = y; tt = mktime (&t); t = *localtime (&tt); printf ("date : %s %.2d/%.2d/%.4d\n", jour[t.tm_wday], d, m, (y+1900)); return 0; }
| |
|