当前时间减去提交的时间 [英] Current time minus the submitted time

查看:64
本文介绍了当前时间减去提交的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作迷你考勤模块,但我不知道这样做,所以请帮助我,用户必须每3小时参加一次,所以如果他们参加3:05,那么与时间的差异将是$ late的价值



这是我在页面中显示时间的代码



 var currentTime =  new  Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (分钟< 10){
minutes = 0 + minutes
}
document.write(hours + +分钟+
if(hours> ; 11){
document.write( PM
} < span class =code-keyword> else {
document.write( AM
}



所以我打算用这个来计算时间进入数据库



 INSERT INTO time_in(late,time_in)
VALUES(' $ late,NOW());



我最大的问题是如何从他们的时间和插入我的数据库所需的时间中获得差异



我有什么尝试过:



i真的不知道该怎么做

解决方案

已故



这是我在页面上显示时间的代码



 var currentTime =  new  Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
< span class =code-keyword> if (分钟< 10){
minutes = 0 + minutes
}
document.write(hours + + minutes +
if(hours> 11){
document.write( PM
} else {
document .write( AM
}



所以我打算用这个来计算时间进入数据库



 INSERT INTO time_in(late,time_in) 
VALUES('


late,NOW());



我最大的问题是如何从他们的时间和插入我的数据库所需的时间中获得差异



我尝试了什么:



i真的不知道该怎么做


看看这个:如何使用PHP减去两个时间值? [ ^ ]


im making a mini attendance module, but i dont have a idea to do this so please help me and the user must attend every 3hrs so if they attend at 3:05 the difference from time will be the value of $late

this is my code of getting the time to show in the page

var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10){
minutes = "0" + minutes
}
document.write(hours + ":" + minutes + " ")
if(hours > 11){
document.write("PM")
} else {
document.write("AM")
}


so im planning to get the time into the database by using this

INSERT INTO time_in(late,time_in)
        VALUES ('$late,NOW())";


and my big problem is how can i get the difference from time required to they time attend and inserted into my database

What I have tried:

i really dont know how to do this

解决方案

late

this is my code of getting the time to show in the page

var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10){
minutes = "0" + minutes
}
document.write(hours + ":" + minutes + " ")
if(hours > 11){
document.write("PM")
} else {
document.write("AM")
}


so im planning to get the time into the database by using this

INSERT INTO time_in(late,time_in)
        VALUES ('


late,NOW())";


and my big problem is how can i get the difference from time required to they time attend and inserted into my database

What I have tried:

i really dont know how to do this


Check this out: How to subtract between two time values using PHP?[^]


这篇关于当前时间减去提交的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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