borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Application Path)Next Topic (How to copy tables from one database to another) New Topic New Poll Post Reply
AndreaVB Forum : Database : Time field calculation
Poster Message
shahidmojid
Level: Professor

Registered: 09-05-2002
Posts: 85

icon Time field calculation

Hi all,

In a table having three fields like
CallStart    (data like 6/18/02 9:26:12 AM) date/time
CallEnd      (data like 6/18/02 9:33:48 AM) date/time
CallDuration ??    

How can i update callduration field with the duration (callstart-callend)

Thanks in advance for any help.

17-09-2002 at 09:36 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: Time field calculation

If the ColDuration is a Date/Time field:
UPDATE Tablename SET CallDuration =CallEnd-CallStart
(however the result will have a 1:29am 12:00pm, 3:00pm for 1:29, 12hours, 15hours)

If the field is numeric, it'll be a decimal point.

Or you could open the table, get the values from CallStart & CallEnd and subtract them via DateDiff, and then store the value in the table.

The last method requires looping through the table.

17-09-2002 at 11:15 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : Time field calculation
Previous Topic (Application Path)Next Topic (How to copy tables from one database to another) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder