Aktualizovat „du3/program.c“
This commit is contained in:
parent
9f69d90153
commit
53a8f29c91
@ -26,14 +26,23 @@ int main()
|
|||||||
t.tm_hour = 0;
|
t.tm_hour = 0;
|
||||||
|
|
||||||
time_t mid = mktime(&t);
|
time_t mid = mktime(&t);
|
||||||
// printf("%ld", (long)mid);
|
|
||||||
struct tm* t2 = localtime(&mid);
|
struct tm* t2 = localtime(&mid);
|
||||||
|
|
||||||
|
|
||||||
|
if(t2->tm_mday < 10){
|
||||||
if(t2->tm_mon + 1 < 10){
|
if(t2->tm_mon + 1 < 10){
|
||||||
printf(" %d.0%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
printf(" %d.0%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
||||||
} else{
|
} else{
|
||||||
printf(" %d.%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
printf(" %d.%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
if(t2->tm_mon + 1 < 10){
|
||||||
|
printf("%d.0%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
||||||
|
} else{
|
||||||
|
printf("%d.%d.%d\n\n", t2->tm_mday, t2->tm_mon + 1, t2->tm_year + 1900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
/*if (time == (time_t)-1) {
|
/*if (time == (time_t)-1) {
|
||||||
printf("fails with error: can't convert date to time!\n");
|
printf("fails with error: can't convert date to time!\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user