Crystal 9, SQL Server 7.0
I have a total mind block, can someone help?
I'm writing a report that has to return data for 5 months ago. Ie, if I run the report on 1st January, it must return the full months data for the whole month of August. It will be going back over years (2005-2004) so I can't just use month - 5. I've got this far:
local datetimevar sdate;
local datetimevar edate;
//to get day 1 of whatever month 5 months ago
sdate := dateadd("m",-5,currentdate);
sdate := DateTime (year(sdate),month(sdate) ,01 ,00 ,00 ,00 );
//to get last day of the month 5 months ago
edate := DateTime (year(sdate),month(sdate) ,?? ,00 ,00 ,00 )
^^ I have a problem with this part, because I don't know how many days will be in the month
Any ideas?
I have a total mind block, can someone help?
I'm writing a report that has to return data for 5 months ago. Ie, if I run the report on 1st January, it must return the full months data for the whole month of August. It will be going back over years (2005-2004) so I can't just use month - 5. I've got this far:
local datetimevar sdate;
local datetimevar edate;
//to get day 1 of whatever month 5 months ago
sdate := dateadd("m",-5,currentdate);
sdate := DateTime (year(sdate),month(sdate) ,01 ,00 ,00 ,00 );
//to get last day of the month 5 months ago
edate := DateTime (year(sdate),month(sdate) ,?? ,00 ,00 ,00 )
^^ I have a problem with this part, because I don't know how many days will be in the month
Any ideas?