기타/PHP
strtotime 1달전 함수문제
죠부니
2024. 11. 11. 14:27
반응형
https://blog.munilive.com/posts/In-strtotime-1-months-or-1-month-ago-is-not-30-days-old.html
샘플정보
<?
$date = "2013-03-30";
$time = strtotime($date);
$prev_month = strtotime("1 months ago", $time);
echo date("Y-m-d", $prev_month);
//결과값 : 2013-03-02
?>
----------------
결론 : first day of 를 이용하여 정확한 달을 만들어야한다
1달전
strtotime("first day of -1 months",$time)
반응형