This commit is contained in:
Kyryl Kobzar 2019-03-12 21:10:21 +01:00
parent b65645ed8a
commit 5681a7d1cc
2 changed files with 12 additions and 9 deletions

BIN
program Executable file

Binary file not shown.

View File

@ -1,13 +1,16 @@
#include <stdio.h>
#include <time.h>
int main(){
//int day = 0;
//int mounth = 0;
//int year = 0;
//scanf("%d.%d.%d", &day, &mounth, &year);
time_t time;
scanf("%e.%m.%Y", &time);
printf("%e.%m.%Y", time);
int main()
{
/* initialize */
int y=0, m=0, d=0;
fgets("%d.%d.%d", &d, &m, &y);
struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d };
/* modify */
t.tm_mday += 40;
mktime(&t);
/* show result */
printf("%s", asctime(&t)); /* prints: Sun Mar 16 00:00:00 1980 */
return 0;
}