Posted by gosha bine on 08/03/07 14:44
On 03.08.2007 13:37 Jerry Stuckle wrote:
> Kesavan wrote:
>> I need a function such it returns true when current time occurs
>> between the parameters.
>>
>> function checkTime($time1,$time2){
>> $nowTime=date("H:i:s");
>>
>> //MY LOGIC IS
>>
>> if( $time1>$nowTime && $time2<$nowTime)
>>
>> ///
>>
>> return true;
>> else
>> return false;
>>
>> }
>>
>> plz guide me the function run.
>>
>
> You can't compare times as strings and expect it to work. You need to
> first convert them to a numeric value, i.e. unixtime format.
>
Times in H:i:s format can be perfectly compared as strings.
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
[Back to original message]
|