#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <dos.h>
char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday" ,
"Thursday", "Friday", "Saturday", "Unknown"};
void main()
{
clrscr();
struct tm tc;
struct date d;
getdate(&d);
/* load the tc structure with the data */
tc.tm_year = d.da_year - 1900;
tc.tm_mon = d.da_mon - 1;
tc.tm_mday = d.da_day;
tc.tm_hour = 0;
tc.tm_min = 0;
tc.tm_sec = 1;
tc.tm_isdst = -1;
/* call mktime to fill in the weekday field of the structure */
if (mktime(&tc) == -1)
tc.tm_wday = 7;
/* print out the day of the week */
printf("%s\n", wday[tc.tm_wday]);
getch();
}
#include <time.h>
#include <conio.h>
#include <dos.h>
char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday" ,
"Thursday", "Friday", "Saturday", "Unknown"};
void main()
{
clrscr();
struct tm tc;
struct date d;
getdate(&d);
/* load the tc structure with the data */
tc.tm_year = d.da_year - 1900;
tc.tm_mon = d.da_mon - 1;
tc.tm_mday = d.da_day;
tc.tm_hour = 0;
tc.tm_min = 0;
tc.tm_sec = 1;
tc.tm_isdst = -1;
/* call mktime to fill in the weekday field of the structure */
if (mktime(&tc) == -1)
tc.tm_wday = 7;
/* print out the day of the week */
printf("%s\n", wday[tc.tm_wday]);
getch();
}
Comment