I have a table name timelogTB and it has 5 column named; LogID(PK),
EmpNo(FK), Time_In, Time_Out
and Date running in form1.
Then in form2 I have a combobox where the Employee # of an employee can be selected and when I will select an Employee # the total number of hours worked of that employee will display in a textbox.
I have two date time picker the dtpicker1
is labeled dtpFrom and dtpicker2
is labeled dtpTo.
The column Time_In
and Time_Out
in timelogTB
is only recording the time in military standard when the employee is time in using also a date time picker.
I am looking forward for a favorable answer guys, as much as possible I want you to explain it more simpler and precise because I am new in vb.net
thanks in advance!
DATEDIFF
of the time_in and time_out (with aWHERE
clause if you require it for a certain date period). e.g.select sum(datediff(second, time_in, time_out) / 60.0 / 60.0) from mytable /* where date between myfirstdate and my second date */
. If the latter, you'd need to convert the values toTIME
first (e.g.cast(left(time_in, 2) + ':' + right(time_in, 2) as time(0))
) then do the same thing. – ZLKselect count(distinct date) from mytable /* where empno = abc and date between date1 and date2 */
– ZLK