jeeva Posted February 21, 2007 Share Posted February 21, 2007 hi frnds, i want calculate how many time between two time? for example if i have selected 12:00 pm and 5:00 pm then answer should be 5 can i calculate like this? and how? thanks in advance jeeva Quote Link to comment Share on other sites More sharing options...
skali Posted February 21, 2007 Share Posted February 21, 2007 int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] ) this function returns tunix_timestamp. Create timestamps of the two dates and subtract them and you have another timestamp. You should divide it by 3600 to get minutes and 86400 to get hours. Quote Link to comment Share on other sites More sharing options...
jeeva Posted February 21, 2007 Author Share Posted February 21, 2007 i did not get u... how it would help me? can u please explain........ Quote Link to comment Share on other sites More sharing options...
skali Posted February 21, 2007 Share Posted February 21, 2007 http://www.php.net/manual/en/function.mktime.php $a = mktime(12,0); $b = mktime(17,0); $diff = $b-$a; print $diff/3600; Here $a is your starting time. and $b is your ending time Quote Link to comment Share on other sites More sharing options...
jeeva Posted February 22, 2007 Author Share Posted February 22, 2007 can i do this in javascript? Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted February 22, 2007 Share Posted February 22, 2007 I dont know about javascript that java can or not... But code make by SKali is fine and good, Working fine... <?php $a = mktime(12,0); $b = mktime(15,0); $diff = $b-$a; print $diff/3600; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.