
strtotime 함수는 상대적인 날짜 표현을 지원하지 않습니다. 하지만, PHP에서 제공하는 DateTime 클래스를 사용하면 가능합니다.
예를 들어, '이번 주'를 표현하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$date = new DateTime('this week');
echo $date->format('Y-m-d');
또한, '다음 주'를 표현하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$date = new DateTime('next week');
echo $date->format('Y-m-d');
또한, '이번 달'을 표현하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$date = new DateTime('this month');
echo $date->format('Y-m-d');
또한, '다음 달'을 표현하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$date = new DateTime('next month');
echo $date->format('Y-m-d');
이러한 방법으로, 상대적인 날짜 표현을 사용할 수 있습니다.
2025-06-07 13:17