I have some events. event are show in application every week depend on inserted day.like
event one > Friday
event two > sat
event three > sun
so event one show in application every Friday 2 am to 2 am
I am confused how to manage and 2 am to 2 am. I already create a logic but its cant give me right calculation
$input = time();
$day = date('D', $input );
switch ($day) {
case 'Sun':
$finalday='0';
break;
case 'Mon':
$finalday='1';
break;
case 'Tue':
$finalday='2';
break;
case 'Wed':
$finalday='3';
break;
case 'Thu':
$finalday='4';
break;
case 'Fri':
$finalday='5';
break;
case 'Sat':
$finalday='6';
break;
}
$now = time();
$event_time = strtotime("02:00 am");
if( ($now - $event_time) < 0) // 5 minutes * 60 seconds, replace with 300 if you'd like
{
//before day
if($finalday=='0')
{
$query_day='6';
}
else
{
$query_day=$finalday-1;
}
}
else
{
//current day
$query_day=$finalday;
}
how can i show each event exactly 2 am to 2 am depend on inserted day
suppose now 12.00 AM so day is Friday but event one will be show from 2.00 AM to next 1.59AM then event two will be show from 2.00 AM to 1.59 AM (sat).
AS this way next weak automatically events will be shown