strtotime

    php - 날짜 연산

    코드 // 시간 연산 $연산후날짜 = date('Y-m-d', strtotime('연산 날짜', strtotime($날짜))); 예시 // 현재로부터의 시간은 다음과 같이 연산 가능 $ago_from_now = date('Y-m-d', strtotime('연산 날짜')); // 예) 2022-04-21 12:00:00 보다 4달 뒤 $four_month_ago_from = date('Y-m-d', strtotime('+4 months', strtotime(date('Y-m-d', strtotime('2022-04-21 12:00:00'))))); debug($four_month_ago_fro..