示例#1
0
        echo date('d-m-Y', strtotime($from));
        ?>
"/>
										-->
										<Select name="date_avail[]" class="form-control">
										<?php 
        $change = 0;
        if (date("Y-m-d", strtotime($from)) < date("Y-m-d", strtotime(date("Y-m-d") . " " . $avail['from']))) {
            $change = "-1";
        } else {
            if (date("Y-m-d", strtotime($from)) > date("Y-m-d", strtotime(date("Y-m-d") . " " . $avail['from']))) {
                $change = "+1";
            }
        }
        //echo " || ".$date_val;
        $dayname = changeWeekday($date_val, $change);
        getWeekday($dayname);
        ?>
										</select>
									</div>
                                    <div class="col-xs-12 col-md-3">
                                        <label class="lbl">Time from</label>
                                        
										<select name="timefrom[]" class="time_from form-control">
										<?php 
        $availability = default_availability();
        foreach ($availability as $avail) {
            echo "<option value='" . $avail . "' ";
            if ($avail == date('H:i:s', strtotime($from))) {
                echo " selected='selected' ";
            }
示例#2
0
 $i = 0;
 foreach ($get_avail as $datetime) {
     $from_dtime = date("Y-m-d", strtotime($date_selected)) . " " . $datetime['from'];
     $to_dtime = date("Y-m-d", strtotime($date_selected)) . " " . $datetime['to'];
     $dayname_db = $datetime['day'];
     $from = convertTimezone($from_dtime, $default_tz, $userTimezone['timezone']);
     $to = convertTimezone($to_dtime, $default_tz, $userTimezone['timezone']);
     $change = "0";
     if (date("Y-m-d", strtotime($from)) > date("Y-m-d", strtotime($from_dtime))) {
         $change = "+1";
     } else {
         if (date("Y-m-d", strtotime($from)) < date("Y-m-d", strtotime($from_dtime))) {
             $change = "-1";
         }
     }
     $dayname_vl = changeWeekday($datetime['day'], $change);
     //echo $from_dtime." | ".$from." | ".$datetime['day']."<br>";
     $available_day[$dayname_vl][$i]['from'] = date("H:i:s", strtotime($from));
     $available_day[$dayname_vl][$i]['to'] = date("H:i:s", strtotime($to));
     $i++;
 }
 //print "<pre>";print_r($available_day);print "</pre>";
 //die;
 foreach ($default_availability as $time_val) {
     $time = $date_selected . " " . $time_val;
     if (strtotime($time) > strtotime($current_time)) {
         $all[] = date("Y-m-d H:i:s", strtotime($time));
         $format_all[] = formatDate($time);
         if (isset($available_day[$dayname_cr]) && count($available_day[$dayname_cr]) > 0) {
             foreach ($available_day[$dayname_cr] as $key => $value) {
                 if (strtotime($time_val) >= strtotime($available_day[$dayname_cr][$key]['from']) && strtotime($time_val) < strtotime($available_day[$dayname_cr][$key]['to'])) {