I make quite a few requests in PHP. I output information from these queries, but I would like to change the date format to something that people except programmers can easily read. Currently, I managed to get through using the following:
$compdt = str_split($fin47['COMPDT']); $compdt = "$compdt[3]$compdt[4]/$compdt[5]$compdt[6]/$compdt[1]$compdt[2]"
The above works great. For example, from the database, I return this for the date:
1090225
After doing the array and string binding, I get the following:
02/25/09
But when I have a date before 2000, returned from the database as follows:
960614
I get this after my line layout:
61/4/60
This is obviously not true, because the number of the century is not there, and also zero for the year.
I just launched a few dates that were before 2000 in a year and all formatting is disabled. Is there any simple way to flip the date around or do I have to have a second array structure for dates prior to 2000?
source share