Link to home
Start Free TrialLog in
Avatar of danjen
danjen

asked on

Convert RFC822 date format in php

Hi Experts-

I have an xml file with a date in  the following format : Sun, 18 Oct 2009 19:00:00 GMT

I want to convert this date to this format 10/18/2009 using PHP.

Thanks for your help.
Avatar of hernst42
hernst42
Flag of Germany image

use strtotime and date()

echo date("m/d/Y", strtotime("Sun, 18 Oct 2009 19:00:00 GMT"));
Avatar of danjen
danjen

ASKER

It returns the date 12/31/1969 when I use this.
Avatar of danjen

ASKER

Still need help with this. Any experts that can provide additional information?
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danjen

ASKER

I figured this out. I was trying to convert the date from an XML file with PHP. I had to parse the XML file first and then use the code provided. Thanks for your help.