Monday, March 12, 2012

Last Day of Previous Month

I am trying to write a formula that will show all records where a date variable is in the month to date or the last day of the previous month. Any ideas?Hi Please Try this syntax

If {table.date} in LastFullMonth Then

{table.date}

Else

0

Its Returns the Value if the date falls on any date from the previous month.

if today is 07/21/2005

its returns 06/30/2005|||I think that will show all days in the previous month, I just need the last day of the previous month. Any ideas?|||Just in case anyone else is having a similar problem I figured out how to calculate the last day of the previous month. This formula will calculate the last day of the month before the current month:

Global datetimevar firstDate:= datetime(year(CurrentDateTime), month(CurrentDateTime),1,0,0,0) ;
Global datetimevar lastMonth:= dateadd("m",+0,firstDate);
lastMonth:=dateadd("d",-1, lastMonth);

Thanks for your help tks_muthu!

No comments:

Post a Comment