Link to home
Start Free TrialLog in
Avatar of jennifere
jennifere

asked on

Date Function

I am trying to use the Date function to return a date range from the current date to 5 days back.  The trick is it needs to be formatted like this:
2003-11-15-2003-11-30

Below is my orginal code.  However, as I discovered this morning, it doesn't take into consideration month changes or leap years.  Is there an easy way to do this??
   
daysBack = Year(Date) & "-" & Month(Date) & "-" & Day(Date) - 5
currentDate = Year(Date) & "-" & Month(Date) & "-" & Day(Date)  
rangeDate = daysBack & "-" & currentDate
Avatar of dancebert
dancebert

Use the DateDiff Function

ASKER CERTIFIED SOLUTION
Avatar of dancebert
dancebert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jennifere

ASKER

That will work-  Thanks.