calculating time differences

1. Rem
Member
Join Date
Dec 1969
Posts
32

## calculating time differences

Hey Guru&#039;s,<BR><BR>I was wondering if anybody know a good way to compute the difference between two time variables.<BR><BR>What I&#039;m looking for is:<BR>TimeA - TimeB = difference. The format of the difference doesn&#039;t matter that much, can alter that myself.<BR><BR>Any ideas?<BR><BR>Thanks a lot,<BR><BR>-Rem

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## Datediff

I know I know But look at it!!

3. Rem
Member
Join Date
Dec 1969
Posts
32

## RE: Datediff

Yup, figures there&#039;s a function that pretty much spells it out!<BR><BR>Thanks a ton for pointing it out to me!<BR><BR>-Rem

4. Senior Member
Join Date
Dec 1969
Posts
96,118

## Actually, since you said...

...that the format of the difference doesn&#039;t matter...<BR><BR><BR>&#060;%<BR>timeA = #3:13:43 AM#<BR>timeB = #2:17:22 PM#<BR><BR>diff = timeB - timeA<BR><BR>Response.Write diff<BR>%&#062;<BR><BR>Not real helpful? Well, that "diff" result is a count of the number of days between the two times.<BR><BR>And of course there are 24 hours in a day, 60 minutes in an hour, etc. So:<BR><BR><BR>&#060;%<BR>timeA = #3:13:43 AM#<BR>timeB = #2:17:22 PM#<BR><BR>diff = timeB - timeA<BR><BR>Response.Write "&#060;P&#062;Days: " & diff<BR>Response.Write "&#060;P&#062;Hours: " & 24*diff<BR>Response.Write "&#060;P&#062;Minutes: " & 24*60*diff<BR>Response.Write "&#060;P&#062;Seconds: " & 24*60*60*diff<BR>%&#062;<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•