我如何计算时间 [英] How do I compute Time

查看:72
本文介绍了我如何计算时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天我正在开发一个带有工资单的考勤系统,我正在使用一个独立的生物识别设备来进出时间,我已经完成了对从生物识别设备收集的数据收集并保存的软件进行编码到mysql数据库,我唯一关心的是如何计算mysql浏览器中的时间和超时之间的时间跨度,如果我得到的数据与此完全相同:



Time_in

2013-12-16 10:41:00





Time_out

2013-12-16 13:05:00





有谁知道如何在sql中计算时间跨度?或者任何人都知道如何在sql中获取时间并将其作为datetimepicker值在vb中传输?我真的需要计算in和out之间的时间乘以员工的基本工资



或者有人知道如何在sql中分隔日期和时间?但价值不会改变。



我使用visual studio 2010 ultimate和Mysql查询浏览器1.2.17作为后端数据库

解决方案

尝试

  SELECT  
TIMEDIFF(t1,t2) as diff
FROM 标签


< blockquote>

  SELECT  TIME_TO_SEC(TIMEDIFF(time_out,time_in))timespan_in_second 
FROM tablename



这将给出秒钟的时间间隔。


Good day Im developing an attendance system with payroll, and im using a stand alone biometric device to get their time in and out, i'm already done in coding the software which gathers the data collected from the biometric device and save it to mysql database, my only concern is how can i compute the time span between time in and time out in mysql browser if the data that i get is exactly the same as this:

Time_in
2013-12-16 10:41:00


Time_out
2013-12-16 13:05:00


anyone knows how to compute time span in sql ? or anyone knows how to get the time in sql and transfer it in vb as datetimepicker value? i really need to compute the time between in and out to multiply it with the employee's basic salary

or anyone knows how to separate the date and time in sql? but the value will not change.

Im using visual studio 2010 ultimate and Mysql query browser 1.2.17 as backend database

解决方案

Try

SELECT
  TIMEDIFF(t1, t2) as diff
FROM tab


SELECT TIME_TO_SEC(TIMEDIFF(time_out, time_in)) timespan_in_second
FROM tablename


This will give the time lapse in second.


这篇关于我如何计算时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆