Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last day of current month? 3

Status
Not open for further replies.

Yerdon

Programmer
Jul 29, 2002
62
US
Hi Everyone,

I know this has to be easy - but I can't figure it out. I want the last day of the current month. Basically, the counterpart to: Minimum(MonthToDate), which returns the first day of the month.

If I use Maximum(MonthToDate) it returns the current date.

Help!!!

Thanks,

Joseph
 
Try:

dateadd("m",1,currentdate-day(currentdate))

-LB
 
There are several variations.
Here is one:

DateAdd("m",1,minimum(monthtodate))-1

~Brian
 
I think LB meant:

dateadd("m",1,currentdate)-day(currentdate)

The other version will not return the correct month end date when the previous month has less days then the current month


~Brian
 
Or...

dateserial(year(currentdate),month(currentdate)+1,1)-1

The dateserial is a nice function to keep in mind for most date work as it always adjusts correctly.

The previous post works fine, just offering up alternatives, and once you understand the basic premise of dateserial, most date functions are very simple.

-k

 
Thanks, Brian, for the fix. It wouldn't have worked right without it.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top