View Single Post
Old 06-29-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Date duration function that returns years, months, weeks and days?


"HAL07" <yahoohal@xxxxxx> wrote in message
news:OOjg8bI%23JHA.4692@xxxxxx
Quote:

> Hi there, do anybody by chance have such a function laying around?
>
> I would like to e.g. output wscript.echo "You are " &
> dateduration(now(), "1980.01.04", "13:42" ) & " old."
>
> Will output:
> You are 29 years, x months, x weeks, x hours and x seconds old
>
>
>
> --
> -- HAL07, Engineering Services, Norway
> -- Info: social.technet.microsoft.com/Forums/ replaces a lot of the
> newsgroups
Use the DateDiff function to determine the difference (in seconds) between
the two dates, then convert the seconds back into years, months, days etc.
Note that your desired output ("You are 29 years, x months") is ambiguous:
Are your months 28, 29, 30 or 31 days long?

If unsure how to use the DateDiff function then I recommend that you
download the help file script56.chm from the Microsoft site.


My System SpecsSystem Spec