Convert date to last calendar date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

How can I convert a given date into the last date of that month? For
example: 5/15/2006 needs to be converted into 5/31/2006. 6/1/2007 needs to
be conveted into 6/30/2007.

Thanks.
 
If the field is named Date1, this expression should give you the last day of
the month:

DateSerial(Year([Date1]), Month([Date1]) + 1, 0)
 
Mark

This may seem a bit circuituous, but you can use the DateSerial() function
to find the day BEFORE the first day of NEXT month. The (untested) code
looks something like:

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

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
That solved my problem,

Thanks.
--
MSS


Allen Browne said:
If the field is named Date1, this expression should give you the last day of
the month:

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mark Senibaldi said:
How can I convert a given date into the last date of that month? For
example: 5/15/2006 needs to be converted into 5/31/2006. 6/1/2007 needs
to
be conveted into 6/30/2007.

Thanks.
 
That solved my problem,

Thanks.
--
MSS


Jeff Boyce said:
Mark

This may seem a bit circuituous, but you can use the DateSerial() function
to find the day BEFORE the first day of NEXT month. The (untested) code
looks something like:

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

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Mark Senibaldi said:
Hi,

How can I convert a given date into the last date of that month? For
example: 5/15/2006 needs to be converted into 5/31/2006. 6/1/2007 needs
to
be conveted into 6/30/2007.

Thanks.
 
Back
Top