Skip to content

Instantly share code, notes, and snippets.

@Aleksandar-Mitic
Forked from chrisdigital/PHP Date converter
Last active October 23, 2017 18:29
Show Gist options
  • Save Aleksandar-Mitic/42eb9d7aafb5d99d7dd7c5dde0457b0c to your computer and use it in GitHub Desktop.
Save Aleksandar-Mitic/42eb9d7aafb5d99d7dd7c5dde0457b0c to your computer and use it in GitHub Desktop.
Little date function to convert XX/XX/XXXX into verbose date (e.g. "January 11, 2015")
<?php
function dateConvert($x_date){
$x_date = explode('/', $x_date, 4);
$x_months = array('','January','Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$x_month = intval($x_date[0]);
$x_day = intval($x_date[1]);
$x_year = $x_date[2];
return ($x_months[$x_month]." ".$x_day. ", ".$x_year);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment