当前时间减去提交的时间 [英] Current time minus the submitted time
问题描述
这是我在页面中显示时间的代码
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屋!