Paul Randall wrote:
Quote:
Quote:
>>
>> 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.
>
> I always thought that the DateDif function returned a double precision
> floating point number, whose whole number part is the number of days
> since the beginning of time for the current operating system and
> whose fractional part is the fraction of the current day that has
> elapsed, and that the resolution is about one eighteenth of a second. No, that sounds more like the definition of the Date datatype (instead
of "beginning of time", use "seed date" which for vb/vba/vbscript is
1899-12-30). From the documentation, the DateDiff function returns an
integer representing "... the number of intervals between two dates. "
This displays "Long":
msgbox typename(datediff("d",#2009-06-01#, date))
--
HTH,
Bob Barrows