mysql统计加班,(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!

解决方案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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值