Ask Question

Menu


How to Split Date in PHP


<!DOCTYPE html>
 <html>
   <body>
<?php
$orderdate="23/10/2017";
$orderdate = explode('/', $orderdate);
$day   = $orderdate[1];
$month = $orderdate[0];
$year  = $orderdate[2];
echo $day."<br>";
echo $month."<br>";
echo $year;
?>
  </body>
 </html>
 

 <!DOCTYPE html>
 <html>
   <body>
<?php
$orderdate="23/10/2017";
$orderdate = explode('-', $orderdate);
$day   = $orderdate[1];
$month = $orderdate[0];
$year  = $orderdate[2];
echo $day."<br>";
echo $month."<br>";
echo $year;
?>
  </body>
 </html>