Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set default date to first of last month and end of last month? 1

Status
Not open for further replies.

cfvcf

Technical User
Nov 8, 2007
77
US
I have two date fields and want to set one to the first day of last month and the second one to the last day of last month. What would be the code to do that?
Thanks!
 
dateadd("m",-1,date()+1-datepart("d",date()))

for first day of last month

dateadd("d",-1,date()+1-datepart("d",date()))

for last day of last month
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top