ExpressiveDate::addOneWeek PHP Method

addOneWeek() public method

Add one week.
public addOneWeek ( ) : ExpressiveDate
return ExpressiveDate
    public function addOneWeek()
    {
        return $this->modifyWeeks(1);
    }

Usage Example

Beispiel #1
0
function eme_create_week_scope($count)
{
    global $eme_timezone;
    $start_of_week = get_option('start_of_week');
    $eme_date_obj = new ExpressiveDate(null, $eme_timezone);
    $eme_date_obj->setWeekStartDay($start_of_week);
    $scope = array();
    $scope[0] = __('Select Week', 'eme');
    for ($i = 0; $i < $count; $i++) {
        $limit_start = $eme_date_obj->copy()->startOfWeek()->format('Y-m-d');
        $limit_end = $eme_date_obj->copy()->endOfWeek()->format('Y-m-d');
        $this_scope = $limit_start . "--" . $limit_end;
        $scope_text = eme_localised_date($limit_start . " " . $eme_timezone) . " -- " . eme_localised_date($limit_end . " " . $eme_timezone);
        $scope[$this_scope] = $scope_text;
        $eme_date_obj->addOneWeek();
    }
    return $scope;
}
All Usage Examples Of ExpressiveDate::addOneWeek