I need to extract dates from a string: For example the string is "...period from 06/01/2014 to 06/30/2014". How can I extract these two dates as:
$date1 = "06/01/2014";
$date2="06/30/2014";
I need to extract dates from a string: For example the string is "...period from 06/01/2014 to 06/30/2014". How can I extract these two dates as:
$date1 = "06/01/2014";
$date2="06/30/2014";
like this
$string = "period from 06/01/2014 to 06/30/2014";
$results = array();
preg_match_all('#\d{2}/\d{2}/\d{4}#', $string, $results);
$date1 = $results[0][0];
$date2 = $results[0][1];