Split date string in PHP
split - Split string into array by regular expression
for Example :
Parse a Date which may b delimited with dots, hypens or slashes-
<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />\n";
?>
2nd Example :-
<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);
// - convert number to month name
$monthNum = $month;
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10)); // March
echo $monthName .' '.$day .', '. $year ;
?>
for Example :
Parse a Date which may b delimited with dots, hypens or slashes-
<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />\n";
?>
2nd Example :-
<?php
//store your date in $date variable
$date = "04-24-2014";
list($month, $day, $year) = split('[/.-]', $date);
// - convert number to month name
$monthNum = $month;
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10)); // March
echo $monthName .' '.$day .', '. $year ;
?>