Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Date problem - check if start of month

Explorer ,
Jun 12, 2009 Jun 12, 2009

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

487
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 12, 2009 Jun 12, 2009

Give this a try...

<cfif dateFormat(now(), "dd") EQ daysinmonth(now())>
       end of month

<cfelse>
       not end of month
</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 12, 2009 Jun 12, 2009

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2009 Jun 14, 2009
LATEST

Schedule a job to run on the 1st of each month.  You should always be able to figure out the previous month.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources