Function to calc. last day of the month

K

Krisse

Is there a function or a format that gives takes any daate
and gives a date that is the last day of that month?

E.g. 10/15/2003 would give 10/31/2003.

Thanks!
 
J

John Vinson

Is there a function or a format that gives takes any daate
and gives a date that is the last day of that month?

E.g. 10/15/2003 would give 10/31/2003.

Thanks!

DateSerial(Year([datefield]), Month([datefield]) + 1, 0)

will do the trick. It's sneaky: it's calculating the zeroth day of the
month following, but it will correctly handle the zeroth day of the
thirteenth month, returning December 31.
 
R

Rick Brandt

Krisse said:
Is there a function or a format that gives takes any daate
and gives a date that is the last day of that month?

E.g. 10/15/2003 would give 10/31/2003.

DateSerial(Year(MyDate), Month(MyDate)+1, 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top