Convert ASP date format to PHP date format ('Y-m-d H:i:s')

I'm using a webservice that's written in asp.net and my script is in php.  When I receive back the datetime field it is in this format:

2010-03-25T18:00:00.00+00:00

Is there way to use this with PHP's date function: date('Y-m-d H:i:s')

I know I can use preg_match or split the string but since I am still learning how to truly master PHP I was hoping to get schooled by an expert in this.
LVL 3
UndisputedAsked:
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.

svenarildCommented:
Just pass along the string of the date to strtotime.

So with other words this will work:
date('Y-m-d H:i:s', strtotime('2010-03-25T18:00:00.00+00:00'));
0
UndisputedAuthor Commented:
I thought that would be the solution too but it does not output the correct time.  It outputs:

2010-03-25 14:00:00
0
svenarildCommented:
Yes, that is correct.

The reason for that is due to your server is not set to the GMT/UTC timezone. The +00:00 means the timezone the time was recorded in.

With other words, since your server is in a different timezone it converts the time so its correct according to the server timezone.

This means that:
2010-03-25 18:00:00 GMT/UTC is the same as 2010-03-25 14:00:00 server time (since its in a different timezone).

If you dont want to convert the time to your timezone, just do this:
date('Y-m-d H:i:s', strtotime(substr('2010-03-25T18:00:00.00+00:00',0,22)));
0

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
svenarildCommented:
Just another note, you can also use the new DateTime class/function if your using php 5.2 or most preferably 5.3.

http://no.php.net/manual/en/class.datetime.php

Its a good system to manipulate time, but the problem with it is that it does not support locale setting, which means that if you for example put the locale to German it will not translate the month, day names etc.
0
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
PHP

From novice to tech pro — start learning today.