Get Month-end

C

chad

Hi,

i have a textbox and i want to display the month-end
for example when my form load i want to get the exact month-end value
i use the "DateAdd("m",-1,Date())" my current date is "Feb 21, 2007" but i
got "Jan 21, 2007" this is good because i calculate the previous date by
month, but i want to get the output of "Jan 31, 2007".

can you please help me with this stuff?

thanks,
chad.
 
R

Rick Brandt

chad said:
Hi,

i have a textbox and i want to display the month-end
for example when my form load i want to get the exact month-end value
i use the "DateAdd("m",-1,Date())" my current date is "Feb 21, 2007"
but i got "Jan 21, 2007" this is good because i calculate the
previous date by month, but i want to get the output of "Jan 31,
2007".

can you please help me with this stuff?

thanks,
chad.

With the DateSerial() function the last day of any month is derived by asking
for the "zeroth" of the next month.

LastDayOfMonth: DateSerial(Year(Date(), Month(Date())+1, 0)
 
F

fredg

Hi,

i have a textbox and i want to display the month-end
for example when my form load i want to get the exact month-end value
i use the "DateAdd("m",-1,Date())" my current date is "Feb 21, 2007" but i
got "Jan 21, 2007" this is good because i calculate the previous date by
month, but i want to get the output of "Jan 31, 2007".

can you please help me with this stuff?

thanks,
chad.

To find the last day of the previous month, you can use:
=DateSerial(Year(Date()),Month(Date())+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