Thread: Date
View Single Post
Old 06-25-2009   #8 (permalink)
Al Dunbar


 
 

Re: Never mind


"Steve" <cerberus40@xxxxxx> wrote in message
news:OEsZuFX9JHA.1488@xxxxxx
Quote:

> Pegasus [MVP] wrote:
Quote:

>> "Larry" <larry328NOSPAM@xxxxxx> wrote in message
>> news:%230n5paV9JHA.1340@xxxxxx
Quote:

>>> I got it, very simple:
>>>
>>> Wscript.Echo MonthName(Month(Now())) & " " & Day(Now()-1)
>>
>> This does not really work since you will have serious problems on
>> days such as 1 July or even worse, on 1 January. Fortunately cscript
>> has a full set of date arithmethic functions such as DateAdd or
>> DateDiff.
>
> Or subtract 1 from the date first and then extract the parts:
>
> Yesterday = Date() - 1
> WScript.Echo MonthName(Month(Yesterday)) & " " & Day(Yesterday)
Your suggestion above also seems to address the unlikely, but potentially
dangerous problem that the date could change between the two calling
instances of the now function.

/Al
Quote:
Quote:

>> I recommend you download the helpfile script56.chm from the Microsoft
>> site to see how they're used.
>
> I endorse that recommendation!
>
> --
> Steve
>
> Heresy is only another word for freedom of thought. -Graham Greene
>


My System SpecsSystem Spec