strtotime problem - different on two seperate servers

Hi I have an URGENT problem,

I have a site I have developed on my local machine, and I have recently uploaded the site to my hosting server.

My problem is all my dates, and date calculation are incorrect! I think I have pinpointed this to strtotime function.

example using this code:

      $birth = strtotime("20-05-1982");
      echo "<br>";
      echo ($birth);                  
      echo "<br>";
      echo "OUTPUT: " . date("d-M-y",$birth);
      echo "<br>";

output locally is;
       OUTPUT: 20-May-82

output on remote server is;
        OUTPUT: 03-Oct-25

differences between local and remote;
  - the server is hosted in US, whereas i'm in Australia
  - Local PHP version 5.2.4, remote is 4.4.7

i think the server is converting the str to time in yyyy mm dd format, but WHY?????

this is quite urgent, so any help is HUGELY appreciated.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The problem is that some countries use MONTH-DAY-YEAR and not DAY-MONTH-YEAR, like America for example. You could flip the date around to make sure it always works:
$birthDate = "20-05-1982";
list($day, $month, $year) = explode('-', $birthDate);
$birthTime = mktime(0, 0, 0, $month, $day, $year);
echo "<br>";
echo ($birthTime);                  
echo "<br>";
echo "OUTPUT: " . date("d-M-y",$birthTime);
echo "<br>";

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jset_expertAuthor Commented:
cool that worked.

i was using strtotime, which seems to be unreliable.

i changed my strtotime functions to mktime, and it all worked OK!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.