beginning of month and end of month

  • Thread starter Thread starter Luc
  • Start date Start date
L

Luc

How can one determine the beginning date of the month
and the end date of the month that follows next.

For example suppose I have a variable
call dtbilldate and let us assume that the value
of dtbilldate = 05/10/2004.

So this is a bill for May, now I need to find out what
the begin date is of the month May and store
that value into vatbegmonth,
next I need to find out
what the end date is of the next month, so the end date of
June. I tried using DateSerial to get these values but
without success. Does anyone knowe exactly on how this
can be accomplished? Many thanks for any help!!!!
 
Using the VB DateAdd function:

subtract the day of the month from the current date to get the Month start.
vatbeginmonth = DateAdd("d",-day(dtbilldate),dtbilldate)+1

Add 2 months to the start of current month (now that you have it) and
subtract 1 day to get the end of next month.
end of following month = DateAdd("m",2,vatbeginmonth)-1

HTH,
 
1st day of dtbilldate month
=DateSerial(Year([dtbilldate]),Month([dtbilldate]),1)
Last day of dtbilldate + 1 month
=DateSerial(Year([dtbilldate]),Month([dtbilldate])+2,0)

Jim
 
Last day of dtbilldate + 1 month
=DateSerial(Year([dtbilldate]),Month([dtbilldate])+2,0)

This won't work correctly for December bill dates.
--
George Nicholson

Remove 'Junk' from return address.


Jim/Chris said:
1st day of dtbilldate month
=DateSerial(Year([dtbilldate]),Month([dtbilldate]),1)

Jim
-----Original Message-----
How can one determine the beginning date of the month
and the end date of the month that follows next.

For example suppose I have a variable
call dtbilldate and let us assume that the value
of dtbilldate = 05/10/2004.

So this is a bill for May, now I need to find out what
the begin date is of the month May and store
that value into vatbegmonth,
next I need to find out
what the end date is of the next month, so the end date of
June. I tried using DateSerial to get these values but
without success. Does anyone knowe exactly on how this
can be accomplished? Many thanks for any help!!!!
.
 
Back
Top