<?
/**************
* Purpose: Format dates with country in consideration
* Precondition: 2 letter country code the individual is from
* Postcondition: date is reformatted for that country
* Note: all available country abbreviations found here:
* http://www.immigration-usa.com/country_digraphs.html
**************/
function formatDate($country)
{
$delimiter = "/";
//these countries should be formatted as day/month/year
$international = array('UK', 'ES', 'FR', 'GB', 'IE');
if (!$country)
return;
if (array_search($country, $international)) //reverse month and year
return date('n') . $delimiter . date('j') . $delimiter . date('Y');
else
return date('j') . $delimiter . date('n') . $delimiter . date('Y');
}
?>
Programming Challenge Main Page or Continue to Day 2