$CI =& get_instance();
$CI->load->model('shop_model');
// echo $shop_id;
$shop_details_new = $CI->shop_model->get_shop_timing($shop_id);
$start_time_new = $shop_details_new->start_time;
$end_time_new = $shop_details_new->end_time;
$start_time_new=str_replace(' ','',$start_time_new);
$end_time_new=str_replace(' ','',$end_time_new);
$start=strtotime($start_time_new);
$end=strtotime($end_time_new);
if ($start <$end) {
while ($start < $end){
echo date('g:i A',$start).'<br>';
$start = $start + 15*60;
}
}
for loop
<?php
$CI =& get_instance();
$CI->load->model('shop_model');
// echo $shop_id;
$shop_details_new = $CI->shop_model->get_shop_timing($shop_id);
$start_time_new = $shop_details_new->start_time;
$end_time_new = $shop_details_new->end_time;
$start_time_new=str_replace(' ','',$start_time_new);
$end_time_new=str_replace(' ','',$end_time_new);
$start=strtotime($start_time_new);
$end=strtotime($end_time_new);
for ($i=$start;$i<=$end;$i = $i + 15*60)
{
//write your if conditions and implement your logic here
echo date('g:i A',$i).'<br>';
}
?>
0 Comments