I have a php script and I need to update the date format from CYYMMDD to MM/DD/YYYY, I wrote a function to do this for me, but when I print it, the result is displayed as an 'Array'.
//将日期格式从CYYMMDD修改为MM/DD/YY function getDate(string $iDATE){ $iDay = substr($iDATE,5,2); $iMonth = substr($iDATE,3,2); $iYear = substr($iDATE,1,2); $iDATE = $iMonth . "/" . $iDay . "/" . $iYear; RETURN $iDATE; }
This is the line of code I'm trying to call the function from:
print "<td align='left' class='Col2'><font face='Calibri' size='3'>".getDate($iDATE)."</td>";
Output: Array
Any ideas?
P粉0715596092024-02-05 00:48:34
getdate is a predefined PHP function that returns an array https://www.php.net/manual/en/function.getdate.php
You should rename your function or encapsulate it in a namespace.