如何在php中从日期函数中获取日、月和年?
我正在从数据库获取php变量中的数据:如何在php中从日期函数中获取日、月和年?,php,validation,cakephp,Php,Validation,Cakephp,我正在从数据库获取php变量中的数据: var_dump("The schedule is: ".$my_Schedule); 我得到以下输出: string(37) "Reviews created : 2019-10-19 03:47:57" 现在我想用这些数据来显示如下内容: // My Desired Result Oct 01, 2019 我不想在这里浪费时间 我是这样做的: <p><?=date('Y-m-d',$my_Schedule);?></
var_dump("The schedule is: ".$my_Schedule);
我得到以下输出:
string(37) "Reviews created : 2019-10-19 03:47:57"
现在我想用这些数据来显示如下内容:
// My Desired Result
Oct 01, 2019
我不想在这里浪费时间
我是这样做的:
<p><?=date('Y-m-d',$my_Schedule);?></p>
$date = date('M d, Y', strtotime('2019-10-19 03:47:57'));
echo $date;
// output Oct 19, 2019
这对我不起作用
请指出我做错了什么
任何想法或建议都会有帮助
谢谢。请使用以下代码
echo date('M d,Y',strtotime('2019-10-19 03:47:57'));
您可以这样使用:
<p><?=date('Y-m-d',$my_Schedule);?></p>
$date = date('M d, Y', strtotime('2019-10-19 03:47:57'));
echo $date;
// output Oct 19, 2019
你用CakePHP标记了这个。你在用蛋糕吗?如果是,版本是什么?