I am trying to get this to work, but I keep getting the same bad result. here is the code
here is the output.Code:#include <stdio.h> #include <time.h> int main() { struct tm date; time_t dt; printf("Enter a day of the month.\n"); scanf("%i", &date.tm_mday); printf("Enter the month.\n"); scanf("%i", &date.tm_mon); printf("Enter the year for 1900.\n"); scanf("%i", &date.tm_year); printf("Enter the day of the weak.\n"); scanf("%i", &date.tm_wday); dt = mktime(&date); printf("%s.\n", ctime(&dt)); return 0; }
bash-2.05b$ ./date
Enter a day of the month.
03
Enter the month.
07
Enter the year for 1900.
104
Enter the day of the weak.
01
Wed Dec 31 17:59:59 1969
.