
- You are not logged in. | Login
November 17, 2006 6:26 am
- mmwfan
- Member


how to check if current time is X min ahead of specified time
Also, I'm wondering this:
I need a function to check if the current time is 30 minutes ahead of a specified time. For example, the specified time is 10:30 am and I want to check if the current time is 11:00 am. Any help is appreciated.
Thanks!
December 20, 2006 11:12 am
- Mr.SMart
- Member


Re: how to check if current time is X min ahead of specified time
Hi.
The function you need:
<?php
/** assume the time in hh:mm [am/pm] format. For example: 11:42 pm.
* returns true if the current time is exactly 30 minutes ahead of a specified time.
*/
function check_30_ahead($time) {
return mktime() == strtotime("+ 30 minutes", strtotime($time));
}


