Date - date = date 
Author Message
 Date - date = date

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



Tue, 13 Sep 2005 00:41:00 GMT  
 Date - date = date
What should be the answers for these examples:
dteDate1 = #2003/03/21 12:00:00#
dteDate2 = #2003/05/27 08:43:27#

dteDate1 = #2003/03/21 12:00:00#
dteDate2 = #2004/01/07 16:43:27#

Bob


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



Tue, 13 Sep 2005 01:04:09 GMT  
 Date - date = date
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



Tue, 13 Sep 2005 04:51:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dates dates dates

2. Compare date in form with date/time in form with date/time in database

3. Dates, Dates, & More Dates

4. Testing one date is not greater than another date in textbox

5. Question: Date manipulation based on a date

6. Record Set Date Compare to Mem Var Date

7. Getting system date (date format and seperator) from JScript

8. write date read date ...

9. data's modified date as update's date

10. Finding the date(s) datapoints between a given start and end date, while excluding weekends

11. start date/time, end date/time problem

12. Type = Date..... checking txt inputs for dates

 

 
Powered by phpBB® Forum Software