1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
char t_timedate[30];
int tc_timedate[5];
inr main()
{
time_t seconds = time(NULL);
strftime(t_timedate, 4,"%M", localtime(&seconds));
tc_timedate[0] = atoi(t_timedate);
printf("%d min\n", tc_timedate[0]);
strftime(t_timedate, 4, "%d", localtime(&seconds));
tc_timedate[1] = atoi(t_timedate);
printf("%d day\n", tc_timedate[1]);
strftime(t_timedate, 4, "%W", localtime(&seconds));
tc_timedate[2] = atoi(t_timedate);
printf("%d week\n", tc_timedate[2]);
strftime(t_timedate, 4, "%m" , localtime(&seconds));
tc_timedate[3] = atoi(t_timedate);
printf("%d month\n", tc_timedate[3]);
strftime(t_timedate, 4, "%Y", localtime(&seconds));
tc_timedate[4] = atoi(t_timedate);
printf("%d year\n", tc_timedate[4]);
}
|