是的,使用和date()一起更改PHP中的日期格式strtotime()。假设以下是我们的约会-
$dateValue = "2020-09-19";
使用strtotime()方法更改日期格式-
$modifiedDate= date("d-m-Y", strtotime($dateValue));<!DOCTYPE html>
<html>
<body>
<?php
$dateValue = "2020-09-19";
echo "The original date format is=",$dateValue,"<br>";
$modifiedDate= date("d-m-Y", strtotime($dateValue));
echo "The changed date format is= ".$modifiedDate;
?>
</body>
</html>输出结果
这将产生以下输出
The original date format is=2020-09-19 The changed date format is= 19-09-2020