By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

how we calculalte the time from a database column

100+
P: 198
Hi
i have two columns in database i,e "operator id" and "data and time"
my probleum is how can i calculate the total time spent by a particular operator while working .
i mean to say when the operator is entering the records at the same time its start time and end time with date is inserted into the "date and time column"
and i want to calculate only the time from that column for a particular operator

if you need some other information please ask me

is there any method of doing this
pleaseeeeeeeeeee help
Apr 26 '08 #1
Share this Question
Share on Google+
7 Replies


lotus18
100+
P: 866
Hi
i have two columns in database i,e "operator id" and "data and time"
my probleum is how can i calculate the total time spent by a particular operator while working .
i mean to say when the operator is entering the records at the same time its start time and end time with date is inserted into the "date and time column"
and i want to calculate only the time from that column for a particular operator

if you need some other information please ask me

is there any method of doing this
pleaseeeeeeeeeee help
Avoid using spaces in naming your fields. Can you show us what have you done so far?

Rey Sean
Apr 26 '08 #2

100+
P: 198
i did nothing beacuse i am not getting any idea i just show you how my database looks

Yp1EOp--------- Yp1EStartTime
153---------------- 4/15/2008 2:39:15 PM
153---------------- 4/15/2008 2:42:31 PM
153 --------------- 4/15/2008 2:42:59 PM
153 --------------- 4/15/2008 2:43:12 PM
153 --------------- 4/15/2008 2:43:24 PM
153 --------------- 4/15/2008 2:43:32 PM
these are few rows of my database
and i want to calculate the time from column "Yp1EStartTime"
please check and tell is it possible to calculate the total time spent from this column. e.g for first two rows the time will be
row2 - row1 = 3 minutes and 16 second


Avoid using spaces in naming your fields. Can you show us what have you done so far?

Rey Sean
Apr 26 '08 #3

lotus18
100+
P: 866
OK, if i got uoir point, you want to get the total time by subtracting the last time and the first time.
Apr 26 '08 #4

lotus18
100+
P: 866
OK, if i got uoir point, you want to get the total time by subtracting the last time and the first time with the same date and operator?

Rey Sean
Apr 26 '08 #5

lotus18
100+
P: 866
Sorry for the double-posting I tried to delete but i cannot see the delete button lol. You can try the DateDiff function and using Where clause from your SQL statement.

Rey Sean
Apr 26 '08 #6

Expert 100+
P: 487
i did nothing beacuse i am not getting any idea i just show you how my database looks
Yp1EOp--------- Yp1EStartTime
153---------------- 4/15/2008 2:39:15 PM
...
If there is a start Time field in a database then, there should available of End time field. Check your database design.
Apr 26 '08 #7

100+
P: 198
Hi
i use Datediff() and it return only hours but i want total time with minutes and seconds at the same time
i use following code for all this and it works fine but when the the time came which i have mentioned in the coding produces wrong output
because the difference between is 1:13:52 but it is showing 12:33:52
how can i correct this please help


Dim Start As Date
Dim Finish As Date
Dim Duration As Date
Dim outStr As String
Dim Length As Integer

'Converting time values to dates
Start = CDate("5:53:05 PM")
Finish = CDate("6:26:57 PM")

'Find duration
Duration = Finish - Start
outStr = CStr(Duration)

'Convert to string an trim AM/PM indicator
Length = InStr(outStr, "AM")
outStr = Mid(CStr(Duration), 1, Length - 2)
MsgBox (outStr)

Sorry for the double-posting I tried to delete but i cannot see the delete button lol. You can try the DateDiff function and using Where clause from your SQL statement.

Rey Sean
Apr 28 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.