Hello FreeBSD Folks,
I want to get yesterday's date with C. I have this code below:
Output of this code is:
My question is how i can get the date format as YearMonthDay (sample; 20100818)
Thanks for your help.
I want to get yesterday's date with C. I have this code below:
Code:
#include <stdio.h>
#include <time.h>
int main()
{
time_t today, yesterday;
today = time(NULL);
printf("Today's date is : %s", ctime(&today));
yesterday = today - 24*60*60;
printf("Yesterday's date was : %s", ctime(&yesterday));
}
Output of this code is:
Code:
Today's date is : Wed Aug 18 06:31:21 2010
Yesterday's date was : Tue Aug 17 06:31:21 2010
Thanks for your help.