Forums

This topic is locked

Difference Between Times

Posted 09 May 2002 15:31:19
1
has voted
09 May 2002 15:31:19 Capuleto Smith posted:
I´ve got a dodgy bussines with times..
I need to know the diference between to times from a DB.. they are in HH:MM:SS format..
I´m using ASP / VBasic.. and trying this code

hora1= TimeSerial(HoraIni,MinIni,0)
hora2= TimeSerial(HoraFi,MinFi,0)
dif = CDate(hora2 - hora1)

Regards
Juan..

TC

Edited by - capuleto on 09 May 2002 18:24:01

Replies

Replied 10 May 2002 18:03:22
10 May 2002 18:03:22 Andrew Watson replied:
Use this...

<pre id=code><font face=courier size=2 id=code>

&lt;%= DateDiff(interval,date1,date2) %&gt;

</font id=code></pre id=code>

interval is the part of the date you want to get the difference between. its values can be...
"yyyy" - Year
"q" - Quarter
"m" - Month
"y" - Day of year
"d" - Day
"w" - Weekday
"ww" - Week of year
"h" - Hour
"n" - Minute
"s" - Second
eg

<pre id=code><font face=courier size=2 id=code>
DateDiff("d","01/01/2002","02/01/2002"
</font id=code></pre id=code>

Would give you 30 for 30 days differnce, (its in MM/DD/YYYY format!!)

PLay around with this, for syntax ref look here....

www.w3schools.com/vbscript/func_datediff.asp

:: Son, im Thirty.... ::

Reply to this topic