Php explode error with date and time

后端 未结 3 1197
轻奢々
轻奢々 2021-01-24 19:36

I have converted my database from mysql to SQL server and working on exploding date and time. I am getting error: explode() expects parameter 2 to be string, This i

3条回答
  •  广开言路
    2021-01-24 20:24

    Try this,

         $time = date('H:i:s'); 
         $date = date('Y-m-d');
         echo $time."
    "; echo $date."
    "; $pieces = explode(":", $time); echo $pieces[0]." ".$pieces[1]." ".$pieces[2]."
    "; $pieces = explode("-", $date); echo $pieces[0]." ".$pieces[1]." ".$pieces[2];

提交回复
热议问题