function dater($old)
{
if (substr_count($old,"/") == 3)
{
list($month, $day, $year) = explode("/", $old);
if ($month < 10) { $month = "0$month"; }
if ($day < 10) { $day = "0$day"; }
return "$month-$day-$year";
}
else { return "-1"; } //invalid date sent to function
}
should work fine....
bah, had a nice little paragraph about sscanf, then after reading the docs to verify I didnt miss anything new with it... learned that sscanf() can return arrays too.... :rolleyes: guess I'm behind on using that now :p
back on topic though
list($month-$day-$year) = sscanf($html_code,"%s-%s-%s");
should be:
list($month, $day, $year) = sscanf($html_code,"%s/%s/%s");
....//if checks and formatting for leading zeros
return "$month-$day-$year";
note: I changed "%s-%s-%s", replaced the -'s with /'s since you originally said your formats were M/D/YYYY not M-D-YYYY