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

Date Range 1

Status
Not open for further replies.

69AceCool

Technical User
May 13, 2005
28
GB
Hi All,

CRXI
ODBC to Remedy ARS 5.1

I am trying to determine a date range that is 2 months from now:

[Date(DateAdd("m", -2, Date(Year(CurrentDate), Month(CurrentDate), 1))) to currentdate - 1

Works fine, however I need to determine the 'earliest' Monday to this date. i.e the date calculated from the above formula always gives me the first day of the month. e.g 01/06/07 which is a Thursday, I need to get to the earliest Monday which would be 29/05/07. If the first day of the month happens to be a Monday then it just uses that date.

Hope that makes sense?
 
You could use:

dateserial(year(currentdate),month(currentdate)-2,1)-dayofweek(dateserial(year(currentdate),month(currentdate)-2,1))+2 to currentdate-1

-LB
 
Thanks lbass!

I've checked the help file on dateserial and have figured out how it works, just needed a push in the right direction... : )

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top