PHP

[PHP] php date format (DateTime::format) 날짜 포맷

chsr 2021. 7. 16. 13:06
728x90
반응형

■ PHP date format (DateTime::format) 날짜 포맷


 사용법

$tmp_date = date_create('20210701235959');
$new_date1 = $tmp_date->format('Y-m-d H:i:s');
$new_date2 = $tmp_date->format('Y-m-d');

echo $new_date1;	//2021-07-01 23:59:59
echo $new_date2;	//2021-07-01

 참고

https://www.php.net/manual/en/datetime.format.php

 

728x90
반응형