Subtracts the specified number of weeks from the timestamp.

@param	timestamp
@param	int
@return	timestamp
196834
public static function subtractWeek($ts = null, $num = 1)
	{
		return sfTime::subtract($ts, $num, sfTime::WEEK);
	}
1235396
public static function distance($timestamp)
    {
        $second = $timestamp - time();
        if ($second > 0) {
            $day = floor($second / (3600 * 24));
            $second = $second % (3600 * 24);//除去整天之后剩余的时间
            $hour = floor($second / 3600);
            $second = $second % 3600;//除去整小时之后剩余的时间
            $minute = floor($second / 60);
            $second = $second % 60;//除去整分钟之后剩余的时间

            $distance = [
                'day' => $day,
                'hour' => $hour,
                'minute' => $minute,
            ];
            return $distance;
        }
    }
554809
public static function roundTimestampToWeek($timestamp)
    {        
        $roundedToDay = self::roundTimestampToDay($timestamp);
        $weekDay  = date('w', $roundedToDay); # 1 = Monday
        $daysToSubtract = $weekDay - 1;
        $roundedToWeek = strtotime("-" . $daysToSubtract . " day", $roundedToDay);
        
        return $roundedToWeek;
    }
278750
public static function finalDayOfMonth($ts = null)
	{
		return sfTime::subtractDay(sfTime::firstDayOfMonth(sfTime::addMonth($ts)));
	}
918417
def subtract_weeks(self, weeks: int) -> datetime:
        
        self.value = self.value - timedelta(weeks=weeks)
        return self.value
964077
public static Date getFromTimestamp(Timestamp timestamp) {
        if (timestamp == null) {
            return null;
        }
        return new Date(timestamp.getTime());
    }
206869
public static Date plusWeeks(Date date, int weeks) {
		return plus(date, weeks, DateTimeField.WEEKS);
	}
430489
public function elapsedTime($timestamp)
    {
        if ($timestamp instanceof DateTime) {
            $timestamp = $timestamp->format('U');
        } else if (is_string($timestamp)) {
            $timestamp = strtotime($timestamp);
        }
        
        $diff = time() - $timestamp; 
        $periods = self::$texts['times']; 
        $lengths = array(60, 60, 24, 7, 4.35, 12, 10); 
        $ending = self::$texts['ago'];
        
        if ($diff < 60) {
            return self::$texts['less_than_a_minute'];
        } else if ($diff < 0) {
            $diff = -$diff; 
            $ending = self::$texts['togo']; 
        }
              
        for($j = 0; $j < count($lengths) && $diff >= $lengths[$j]; $j++) {
            $diff /= $lengths[$j]; 
        }
        $diff = round($diff); 
        if($diff != 1) {
            $periods[$j].= "s"; 
        }
        
        if (self::$agoAfter) {
            return "$diff $periods[$j] $ending";
        } else {
            return "$ending $diff $periods[$j]";
        }
    }
735818
static function num2week($num, $two = true)
    {
        if ($num == '6')
        {
            $num = '日';
        }
        else
        {
            $num = Tool::num2han($num + 1);
        }
        if ($two)
        {
            return self::WEEK_TWO . $num;
        }
        else
        {
            return self::WEEK_THREE . $num;
        }
    }
127860
public static function subtractMillenium($ts = null, $num = 1)
	{
		return sfTime::subtract($ts, $num, sfTime::MILLENIUM);
	}
356678
private function timecode(int $timestamp): int
    {
        return (int) floor(($timestamp - $this->getEpoch()) / $this->getPeriod());
    }
216680
public TimeDuration durationBetween(Timestamp time) {
        long nanoSecDiff = time.nanoSec - nanoSec;
        nanoSecDiff += (time.unixSec - unixSec) * 1000000000;
        nanoSecDiff = Math.abs(nanoSecDiff);
        return TimeDuration.ofNanos(nanoSecDiff);
    }
358335
@Override
  public long getNextIncludedTime (final long nTimeStamp)
  {

    // Call base calendar implementation first
    long timeStamp = nTimeStamp;
    final long baseTime = super.getNextIncludedTime (timeStamp);
    if ((baseTime > 0) && (baseTime > timeStamp))
    {
      timeStamp = baseTime;
    }

    // Get timestamp for 00:00:00
    final Calendar day = getStartOfDayJavaCalendar (timeStamp);
    while (isTimeIncluded (day.getTime ().getTime ()) == false)
    {
      day.add (Calendar.DATE, 1);
    }

    return day.getTime ().getTime ();
  }
141066
public function subtractDays($days)
    {
        $days = (int) $days;
        $days = -$days;
        return $this->addDays($days);
    }
142723
private static function timestampToCounter($timestamp, $timeStep)
    {
        $timestamp = abs(intval($timestamp));
        $counter = intval(($timestamp * 1000) / ($timeStep * 1000));

        return $counter;
    }
1359551
private function getTimestamp($timestamp)
    {
        if ($timestamp instanceof \DateTime) {
            $timestamp = $timestamp->getTimestamp();
        }

        if ((int)$timestamp != $timestamp) {
            throw new ResqueSchedulerInvalidTimestampException(
                'The supplied timestamp value could not be converted to an integer.'
            );
        }

        return (int)$timestamp;
    }
1248013
private static function getTimestamp($timestamp)
	{
		if ($timestamp instanceof DateTime) {
			$timestamp = $timestamp->getTimestamp();
		}
		
		if ((int)$timestamp != $timestamp) {
			throw new ResqueScheduler_InvalidTimestampException(
				'The supplied timestamp value could not be converted to an integer.'
			);
		}

		return (int)$timestamp;
	}