Selection of last day of the month

D

DontKnow

Hi Guys,

I need to be able to select the lasst day of each month in a text box eg. as
we are currently in the Month of August I need to be able to have the 31 Aug
09 to be displayed in a text box and so on for every month of the year!

is there any code that is already does this??

Please help me ,

cheers,
 
R

Rick Brandt

Hi Guys,

I need to be able to select the lasst day of each month in a text box
eg. as we are currently in the Month of August I need to be able to have
the 31 Aug 09 to be displayed in a text box and so on for every month of
the year!

is there any code that is already does this??

Do you want to display it with an expression or store it as a default
value? Either would use the DateSerial() function.

=DateSerial(Year(Date()), Month(Date()) + 1, 0)

Explanation: The zeroth of a month is the last day of the previous
month. So you go one month past this month and get the zeroth day of
that. This works at year-end wrap-around and with leap years.
 
D

DontKnow

Bloody beautiful mate!!

Rick Brandt said:
Do you want to display it with an expression or store it as a default
value? Either would use the DateSerial() function.

=DateSerial(Year(Date()), Month(Date()) + 1, 0)

Explanation: The zeroth of a month is the last day of the previous
month. So you go one month past this month and get the zeroth day of
that. This works at year-end wrap-around and with leap years.
 

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