01-07-2008, 03:42 PM
i have stored the date in the following format...
it is year,day,month, hour,min,sec
and wish to convert it to the format needed for RSS feeds.
"D, d M Y H:i:s GMT"
how can i do this please.
This should work (untested!):
$original_date = "2008-01-07 15:42:00";
$reformatted_date = date("D, d M Y H:i:s \G\M\T", strtotime($original_date));
Might come out with 7th Jan rather than 1st July though ...
01-07-2008, 04:09 PM
i have PHP version 4.3.11
is there another way?
Both date() and strtotime() are present in all versions of PHP4 :)
Opps! Just noticed you'd replied to the original version of my message! Lol! Yep, the edited one should work - but watch the d/m thing m/d thing
01-07-2008, 04:22 PM
Where do you have it stored in that format?
Edit: And do you truely want that to be - year,day,month or do you want it to be year,month,day?
Indeed, if it's in a MySQL database you can use the DATE_FORMAT function.