これは次土曜日表示次の3土曜日
<?php echo date("l,j M Y", strtotime("next saturday")); ?>
すなわち7月23日(土曜日)を示し、2011年、私はまた、2011年7月とそう
に土曜日30で、次の次の土曜日を表示したいこれは次土曜日表示次の3土曜日
<?php echo date("l,j M Y", strtotime("next saturday")); ?>
すなわち7月23日(土曜日)を示し、2011年、私はまた、2011年7月とそう
に土曜日30で、次の次の土曜日を表示したい、\日時と
strtotime("next saturday + 1 week")
strtotime("next saturday + 2 weeks")
...
もちろん、どこでも「週」を使用できます。 'strtotime("次の土曜日+ $週の週 ")' – Naltharial
の日付( "Y-m-d"、strtotime( '土曜日+1週間')) –
$next_saturday = strtotime("next saturday");
$the_saturday_after_that = strtotime("next saturday", $next_saturday);
...など。
PHP 5.2+を使用すると、次の3土曜日を取得するためにDateTime
とDateInterval
を使用することができます。
例:また
<?php
$date = new DateTime('next saturday');
// Loop 3 times.
for ($i = 0; $i < 3; $i++)
{
echo $date->format('Y-m-d') . PHP_EOL;
// Add 1 month.
$date->add(new DateInterval('P7D'));
}
例:
/**
* Get next three saturday
*
* @return \DateTime[]
*/
function getNextThreeSaturday()
{
$count = 3;
$current = new \DateTime('saturday this week');
$results = [];
for ($i = 0; $i < $count; $i++) {
$results[] = clone $current->modify('next saturday');
}
return $results;
}
質問は不完全です。 「これ」とは何を意味しますか? –
*(参考)* http://php.net/manual/en/datetime.formats.relative.php – Gordon