Function to calc. last day of the month

  • Thread starter Thread starter Krisse
  • Start date Start date
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!
 
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.
 
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)
 
Back
Top