I have the following problem. I have a script that gets the Airdate of TV Shows and i alter it before I save it to my database. Locally on my localhost it works perfect, but when I tried it online and uploaded it to my web server it shows a different behavior. I have no idea why it is so.
Here are some examples:
The Data I get: Aired 1/22/12
What the outcome of my script should be: 2012-01-22
What I get online: 2022/12–
The Data I get: Aired 8/29/11
What the outcome of my script should be: 2011-08-29
What I get online: 2029/11–
The Data I get: Airs 2/12/12
What the outcome of my script should be: 2012-02-12
What I get online: 2012/12–
Here is my PHP script:
if(strstr($serie['airdate'], 'Airs')) {
$date = substr($serie['airdate'], 5);
}
if(strstr($serie['airdate'], 'Aired')) {
$date = substr($serie['airdate'], 6);
}
$mm = strstr($date, "/", true);
$mmStrLen = strlen($mm);
if((strlen($mm)) == "1") {
$mm = "0".$mm;
}
$dd = substr($date, $mmStrLen+1);
$dd = strstr($dd, "/", true);
$ddStrLen = strlen($dd);
if((strlen($dd)) == "1") {
$dd = "0".$dd;
}
$yy = substr($date, $mmStrLen+1+$ddStrLen+1);
if((strlen($yy)) == "1") {
$yy = "0".$yy;
}
$serie['date'] = "20".$yy."-".$mm."-".$dd;
$serie[‘airdate’] is the data I get and $serie[‘date’] is where the altered value should be saved.
The PHP Version I use locally is 5.3.8 and the one of my webhoster is 5.2.17. But I guess this is not the root of the problem.
Can’t format a comment as code, so I must write it as an answer.
Please try this on both sides