PHP - How to get year, month, day from time string

后端 未结 4 1010
粉色の甜心
粉色の甜心 2020-12-15 18:18

Given the following timestring:

$str = \'2000-11-29\';

$php_date = getdate( $str );
echo \'
\';
print_r ($php_date);
echo \'
\';
4条回答
  •  自闭症患者
    2020-12-15 19:16

    PHP - How to get year, month, day from time string

    $dateValue = strtotime($q);                     
    
    $yr = date("Y", $dateValue) ." "; 
    $mon = date("m", $dateValue)." "; 
    $date = date("d", $dateValue); 
    

提交回复
热议问题