03-22-2018 04:59 AM
Hello,
I'm getting the current system date.
I need to get the last week date. So :
if current date = 22/03/2018 => last week = 15/03/2018
if current date = 02/03/2018 => last week = 23/02/2018
if current date = 02/04/2018 => last week = 26/03/2018
etc....
Any ideas please ?
Thanks !
Solved! Go to Solution.
03-22-2018 05:15 AM
i suppose that you can use:
GetSystemDate (&month2, &day2, &year2);
sprintf (TimeBuffer, "%02i- %02i / %02i", day2+8, month2-1, year2);
or:
GetSystemDate (&month2, &day2, &year2);
sprintf (TimeBuffer, "%02i- %02i / %02i", day2+24, month2-1, year2);
03-22-2018 06:45 AM
I propose the use of "CVI Time" from the Utility Library:
t = GetCurrentCVIAbsoluteTime()
CVITimeIntervalFromTimeUnit (CVITimeUnitDays, 7, &i);
DecrementCVIAbsoluteTime (&t, i);
CVIAbsoluteTimeToLocalCalendar( ... );
03-22-2018 08:10 AM
Hello venusnajad56,
The main idea is to not be obliged to calculate the date .... otherwise, I have to implement many cases.
I'm looking for something "automatic".
03-22-2018 08:23 AM
Hello CVI-User,
It's the solution. Thank you.