Copy link to clipboard
Copied
HI Folks,
I'm creating a basic counter, where hits are stored in a db, but I would like to dump the totals in a seperate table at the end of each month. So I can keep monthly hit stats.
Can anyone please tell me how I can tell if its the end of the month, and then dump the results for that month in a seperate table/ text file
Thankyou
Copy link to clipboard
Copied
Give this a try...
<cfif dateFormat(now(), "dd") EQ daysinmonth(now())>
end of month
<cfelse>
not end of month
</cfif>
Copy link to clipboard
Copied
What is the purpose of creating separate tables? Why not leave the hits in the current table, and query the table for watever time period you want?
Copy link to clipboard
Copied
Schedule a job to run on the 1st of each month. You should always be able to figure out the previous month.