1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| // On recupere le format de la date local dans une variable
time_t t;
struct tm * pTime;
t = time(NULL);
pTime = localtime(&t);
char ch[80+1], fmt[80+1], * pcloc;
struct tm * pdh; time_t intps; int nbc;
intps=time(NULL); pdh = localtime(&intps);
// Format anglais entier
printf("Format anglais entier :\n");
nbc = strftime(ch, 81, "Bienvenue sur cette machine nous sommes le\n %A %d %B %Y", pdh); // On recupere la date entiere dans un fichier
printf("%s, ", ch); // On affiche le fichier
printf("il est %d:%d\n\n", pTime->tm_hour, pTime->tm_min); // Affichage de l'heure
// Format decimal (non-traité)
printf("Format decimal (non-traite) :\n");
nbc = strftime(ch, 81, "%Y", pdh); // On récupere la date dans un fichier
printf("Bienvenue sur cette machine nous sommes le\n %d %d %d %s, il est %d:%d\n", pTime->tm_wday, pTime->tm_mday, pTime->tm_mon, ch, pTime->tm_hour, pTime->tm_min); |
Partager