how to get End of month for reporting

Dear Experts , 

i'm doing a report for incidents  opened from the begining of the current month till the end of the current month 

i now that there are a function now named startofmonth() . is there another function that i can get the date of end the current month 

i tried endofmonth()  and startofmonth() 30 00:00:00 and it did not work 

any ideas ?

Parents
  • Verified Answer

    Since you said "end of the current month", why do you need to have an end time in your query? If you are always going to be running this in the month for which it applies, you only need to filter on 'after' and can ignore 'before'.

    That being said, this should do the trick:

    open.time>startofmonth() and month(open.time)<month(tod()) 1 and year(open.time)=year(tod())

    Keep in mind, that's going to show you January's tickets if you run the query in January. If you want to run a query in February to see January's tickets, that changes your question completely.

Reply
  • Verified Answer

    Since you said "end of the current month", why do you need to have an end time in your query? If you are always going to be running this in the month for which it applies, you only need to filter on 'after' and can ignore 'before'.

    That being said, this should do the trick:

    open.time>startofmonth() and month(open.time)<month(tod()) 1 and year(open.time)=year(tod())

    Keep in mind, that's going to show you January's tickets if you run the query in January. If you want to run a query in February to see January's tickets, that changes your question completely.

Children