Click here to Skip to main content
15,900,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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){
} else {

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
Updated 6-Feb-17 20:36pm
Mohibur Rashid 7-Feb-17 2:33am    
The first code block does not look like php, it's look like javascript

For php try this link
For javascript try this
For mysql try this

Member 12986530 7-Feb-17 2:55am    
yes its a javascript

its just to tell the user what time it is and

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900