I have a variable called $orderdate and it is set to a date format like this mm-dd-yyyy.
In PHP how would I split this variable into $month, $day, $year?
Tha
A good approach is to use date_parse_from_format().
For your example:
$dateStr = '03-27-2015'; $dateArray = date_parse_from_format('m-d-Y', $dateStr);
This gives $dateArray as:
$dateArray
Array ( [year] => 2015 [month] => 3 [day] => 27 [hour] => [minute] => [second] => ... )