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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First Day of Month 1

Status
Not open for further replies.

LLowrance

Programmer
May 11, 2004
47
0
0
US
Crystal 8.5
SQL Server

I'm trying to write record selection criteria where I need to always find the first day of the month of currentdate 3 years ago as well as the first day of the month of the currentdate.

Examples:
Currentdate=1/21/2010
{db.date} in 1/1/2007 to 1/1/2010

Currentdate=4/8/2010
{db.date} in 4/1/2007 to 4/1/2010

Can anyone assist? I'm sure this is very easy.

Thanks for your help.

-LLL
 
formula for 1st of month 3 years ago: dateserial(year(currentdate)-3,1,month(currentdate))


formula for 1st of current month:
dateserial(year(currentdate),1,month(currentdate))
 
Thanks very much. I was using the same thing but was trying to use something for day and was getting a too many arguments error.
Thanks again

-LLL
 
In both formulas the arguments for month and day should be reversed, e.g.:

dateserial(year(currentdate)-3,month(currentdate),1)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top