Hi Azz-P
Quote:
> Need help with getting the difference of 2 dates
> in a date format. e.g.
> dteDate1 = #2003/03/21 12:00:00#
> dteDate2 = #2003/05/27 16:43:27#
> ' Please fill in the blanks
> ' value of dteResult = #0000/02/6 04:43:27#
> I have tried many ways including datediff(), but i cannot
> get the correct answer. Going out of my mind with this
> one. There must be a simple way.
> Thanks in advance
> Azz P
See if you can morph this into what you want:
<code>
dteDate1 = #2003/03/21 12:00:00#
dteDate2 = #2003/05/27 16:43:27#
arOP = array( "yyyy", "Years", "m", "months", "d", "days", _
"h", "hours", "n", "minutes", "s", "seconds")
for nJ= LBound(arOP) to Ubound(arOP) step 2
diff = datediff(arOP(nJ), dteDate2, dteDate1)
sOut = sOut & " " & diff & " " & arOP(nJ + 1)
dteDate2 = dateadd( arOP(nJ), diff , dteDate2 )
next
wscript.echo sOut
</code>
cheers,
Mark Pryor