Horde_Date::dateString PHP Method

dateString() public method

Formats date and time to be passed around as a short url parameter.
public dateString ( ) : string
return string Date and time.
    public function dateString()
    {
        return sprintf('%04d%02d%02d', $this->_year, $this->_month, $this->_mday);
    }

Usage Example

Ejemplo n.º 1
0
 protected function _hours()
 {
     global $prefs;
     $hours_html = '';
     $dayWidth = round(100 / $this->_days);
     $span = floor(($this->_endHour - $this->_startHour) / 3);
     if (($this->_endHour - $this->_startHour) % 3) {
         $span++;
     }
     $date_format = $prefs->getValue('date_format');
     for ($i = 0; $i < $this->_days; $i++) {
         $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $day_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Day\',' . $t->dateString() . ');')) . $t->strftime($date_format) . '</a>';
         $hours_html .= sprintf('<th colspan="%d" width="%s%%">%s</th>', $span, $dayWidth, $day_label);
     }
     $hours_html .= '</tr><tr><td width="100" class="label">&nbsp;</td>';
     $width = round(100 / ($span * $this->_days));
     for ($i = 0; $i < $this->_days; $i++) {
         for ($h = $this->_startHour; $h < $this->_endHour; $h += 3) {
             $start = new Horde_Date(array('hour' => $h, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
             $end = new Horde_Date($start);
             $end->hour += 2;
             $end->min = 59;
             $this->_timeBlocks[] = array($start, $end);
             $hour = $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00');
             $hours_html .= sprintf('<th width="%d%%">%s</th>', $width, $hour);
         }
     }
     return $hours_html;
 }
All Usage Examples Of Horde_Date::dateString