I want to get yesterday date in char format in the format: YYYYMMDD (without a slash, etc.).
I use this code to get today's date:
time_t now;
struct tm *ts;
char yearchar[80];
now = time(NULL);
ts = localtime(&now);
strftime(yearchar, sizeof(yearchar), "%Y%m%d", ts);
How can I adapt this code so that it generates yesterday's date instead of today?
Many thanks.
source
share