(Vb.net和MYSQL)我想计算每个日期的加班时间,时间和时间。晚了 [英] (Vb.net and MYSQL)I want to calculate number of hour in every date with overtime, under time & late
本文介绍了(Vb.net和MYSQL)我想计算每个日期的加班时间,时间和时间。晚了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I Create table name tblattlogs
Create 5 columns:
logsid
UserId
INOUTMODE
DATE
TIME
INOUTMODE:
0=Time IN
1=Time OUT
logsid useid INOUTMODE date time
1 1 0 7/1/2017 8:00
2 1 1 7/1/2017 17:00
3 1 1 7/1/2017 17:10
4 1 0 7/2/2017 8:10
5 1 1 7/2/2017 17:00
6 2 0 7/1/2017 8:00
7 2 1 7/1/2017 17:00
8 2 0 7/2/2017 8:00
9 2 1 7/2/2017 16:10
As you can see in userid 1,date 7/1/2017 the user time out twice so i just want to calculate 8:00 to 17:10 totalHOurs=9:10, and if greater than 17:00 it will count as overtime else less than 17:00 it will count under time.and in userid 1,date 7/1/2017 the time IN=8:10 in will be status late.
i will set every user timecode 8:00 to 17:00.
RESULT:
Userid Date LoginTime LogoutTime TotalHours Totallate/Overtime status
1 7/1/2017 8:00 17:10 9:10 00:10 complete
1 7/2/2017 8:10 17:00 8:50 00:10 Late
1 7/1/2017 8:00 17:00 9:00 00:00 complete
2 7/2/2017 8:00 16:10 8:10 00:50 undertime
我尝试过:
我不知道该怎么做。我想成为那样的结果,我不知道如何启动代码。请帮我这个问题。谢谢!
What I have tried:
I don't know what to do.I want to be the result like that and i don't know how to start the code.Please Help me with this problem. Thank You!
推荐答案
LoginTime和LogoutTime是哪些类型?
如果是Date,你可以建立一个TimeSpan ...
Which types are LoginTime and LogoutTime ?
If they are Date you can build a TimeSpan ...
Dim d1, d2 As Date
Dim d3 As TimeSpan
d3 = d1.Subtract(d2)
这篇关于(Vb.net和MYSQL)我想计算每个日期的加班时间,时间和时间。晚了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文