• You are not logged in. | Login

Post a reply

  • Index
  •  » Help me!
  •  » how to check if current time is X min ahead of specified time

November 17, 2006 6:26 am

mmwfan
Member
Ranks

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
Ranks

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));
}

 

 
  • Index
  •  » Help me!
  •  » how to check if current time is X min ahead of specified time
  • Actions
  • Top
ITCrimea. Ukraine Web Development Company. Professional Developers and Web Designers Team
Custom Web Designs, Internet Applications, E-Commerce Websites, Interactive Sites, Database-Driven Sites and Services