Orang3
Orang3
CCoder.com
Created by Orang3 on 6/2/2024 in #help
ctime
The task we have is the present time 06/02/2024, the task is to convert the time to the number 02062024, how can this be done? Below is the code that needs conversion
struct tm newtime;
time_t now = time(NULL);
localtime_s(&newtime, &now);

int date = newtime.tm_mday * newtime.tm_mon * 1 * newtime.tm_year * 1900;
struct tm newtime;
time_t now = time(NULL);
localtime_s(&newtime, &now);

int date = newtime.tm_mday * newtime.tm_mon * 1 * newtime.tm_year * 1900;
5 replies