Nati323 Posted March 29, 2015 Share Posted March 29, 2015 hey, i need a function that i give her time start and time end, and it returned how much time there is between the two times, something like array_diff , but only for hours,seconds,and time... thanks. Link to comment Share on other sites More sharing options...
Ingolme Posted March 30, 2015 Share Posted March 30, 2015 You can create two Javascript Date() objects for the start time and end time, then subtract the start timestamp from the end timestamp. The result will be a number in milliseconds. Divide by 1000 to get seconds and then by 3600 to get the number of hours. You can use the modulo operator and Math.floor() to get a combination of hours, minutes and seconds. Link to comment Share on other sites More sharing options...
Nati323 Posted March 30, 2015 Author Share Posted March 30, 2015 ok , i thought about js, so you say that in php there is no way to calculate dates...? Link to comment Share on other sites More sharing options...
dsonesuk Posted March 30, 2015 Share Posted March 30, 2015 http://stackoverflow.com/questions/3108591/calculate-number-of-hours-between-2-dates-in-php Link to comment Share on other sites More sharing options...
Nati323 Posted March 30, 2015 Author Share Posted March 30, 2015 thanks you both. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now