View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chad[_3_] Chad[_3_] is offline
external usenet poster
 
Posts: 32
Default Need a date range

Thanks Dave, always fast on the replys.


startdate = "0" & enddate - 7 'startdate equals "080999"
x = Format(startdate, "YYMMDD")

x = 211006

Not sure what is happening, but it is wrong. I guess it is thinking my
startdate is a different format that YYMMDD

Chad



"Dave Peterson" wrote in message
...
Do your arithmetic against the real date--then format the result:

Dim myDate as date
mydate = date - 14
msgbox format(mydate, "yymmdd")


Chad wrote:

Hi All,

I am trying to store todays date minus x amount of days. So I get todays
date with Date Function, format it to YYMMDD. Now my problem is, today
is
the 12, so if I minus 2 weeks I get 80999, not 080929. So it drops my
leading zero and ignores the month

How do I maintain a date structure across month changes.

Thanks
Chad


--

Dave Peterson