View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Need a date range

I don't understand.

I still think you'd be better off just working with the dates--not the formatted
strings.

Is there a reason you can't work with the real date?

Chad wrote:

It's not nice, but I broke apart the date and rearranged the numbers so that
the format liked it.
It you know a better way, that would be better.

Chad

x = Right(enddate, 2) & "/" & Mid(enddate, 3, 2) & "/" & Left(enddate, 2)
x = Format(x, "YYMMDD")

"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


--

Dave Peterson