Hier soir, j'ai essayé sous DOS sur mon vieux DX4/100.
L'exemple Borland m'a donné Monday pour le Year 2002, month 4, day 15.
C'est bien
#include <stdio.h>
#include <time.h>
char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Unknown"};
int main(void)
{
struct tm time_check;
int year, month, day;
/* Input a year, month and day to find the weekday for */
printf("Year: " );
scanf("%d", &year);
printf("Month: " );
scanf("%d", &month);
printf("Day: " );
scanf("%d", &day);
/* load the time_check structure with the data */
time_check.tm_year = year - 1900;
time_check.tm_mon = month - 1;
time_check.tm_mday = day;
time_check.tm_hour = 0;
time_check.tm_min = 0;
time_check.tm_sec = 1;
time_check.tm_isdst = -1;
/* call mktime to fill in the weekday field of the structure */
if (mktime(&time_check) == -1)
time_check.tm_wday = 7;
/* print out the day of the week */
printf("That day is a %s\n", wday[time_check.tm_wday]);
return 0;
}