Hi
I have a program that issues at midnight the summary of the past day.
It should issue the summary in a line appended to a file. That file should be in the csv format, for post processing in Excel.
All is done now.
But I would like to begin the line with a date identifier. Only day/month. And that identifier should be the day of yesterday (because I print after midnight)
Has someone got an idea how to code that in c++?
Thank you for any hint...
How to print the date of yesterday?
Re: How to print the date of yesterday?
Finally I found out alone.
Enjoy!
- //***Variables for Time***
- tm* timeinfo;
- tm* yesterdaytimeinfo;
- time_t now;
- time_t yesterdaynow;
- static char charbuff[120]; //Char buffer for many functions
- //*** In program ***
- yesterdaynow = now - 86400;
- yesterdaytimeinfo = localtime(&yesterdaynow);
- strftime(charbuff, 30, "%x ", yesterdaytimeinfo);
- println();
- print(charbuff);
Who is online
Users browsing this forum: No registered users and 34 guests