Варианты и примеры
Чтоб примеры работали так же добавить
date_default_timezone_set('Europe/Moscow');
Пример 1
<?php
$current_time = strtotime('now');
if ($current_time > strtotime('Wednesday 14:30') && $current_time < strtotime('Wednesday 15:00')) {
echo 'current_time yes';
} else {
echo 'no this';
}
?>
Еще
<?php
if(time() > strtotime(date('Y-m-d').' 15:00') ) {
echo 'yes';
} else {
echo 'no';
}
?>
Еще
<?php
date_default_timezone_set('Europe/Moscow');
$currentTime = date( 'H:i:s A', time () );
echo $currentTime;
// such comparison exists in PHP >= 5.2.2
$now = new DateTime();
$twoPm = new DateTime();
$twoPm->setTime(15,0); // 2:00 PM
if ( $twoPm < $now ) {
echo 'Special logo';
} else {
echo 'No no ';
}
?>
Выводим рандомное время
$start = strtotime("2012-10-01 00:00:00");
$end = strtotime("2012-12-31 23:59:59");
$randomDate = date("Y-m-d H:i:s", rand($start, $end));
echo $randomDate;





