공부하자/PHP
[PHP] 날짜 더하기
YoBot
2019. 1. 14. 12:16
[PHP] 날짜 더하기
strtotime('날짜',"더할 날");
사용 예제
1 2 3 4 5 6 7 8 9 | <?php $today = "2019-01-12"; echo date("Y-m-d", strtotime($today."+1years"))."<BR>"; echo date("Y-m-d", strtotime($today."+1day"))."<BR>"; echo date("Y-m-d", strtotime($today."+1 week"))."<BR>"; echo date("Y-m-d", strtotime($today."+24 hours"))."<BR>"; echo date("Y-m-d", strtotime($today."+1500 minutes")); ?> | cs |
출력값
2020-01-12
2019-01-132019-01-19
2019-01-13
2019-01-13