Minklet Posted January 20, 2011 Share Posted January 20, 2011 Hi, I'm making an RSS feed http://dev.subverb.net/mixes_rss.php and as you see the date('r', $row['date']) function is not converting it. I've echo'd $row['date'] into the description to show what format the date is in (just mysql datetime. Am I missing something? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/225052-dater-function-not-working/ Share on other sites More sharing options...
BlueSkyIS Posted January 20, 2011 Share Posted January 20, 2011 date() takes a timestamp. you'll need to convert to timestamp via SQL or PHP before using date(). http://php.net/manual/en/function.date.php Quote Link to comment https://forums.phpfreaks.com/topic/225052-dater-function-not-working/#findComment-1162356 Share on other sites More sharing options...
PFMaBiSmAd Posted January 20, 2011 Share Posted January 20, 2011 Just use the mysql DATE_FORMAT() function in your query when you retrieve the value. No slow parsed, tokenized, interpreted php code is needed. You are already executing a query to retrieve the data. Adding a mysql DATE_FORMAT() function in the query adds a minuscule amount of time to the query, whereas doing this in php code takes a minimum of 8 times longer then it takes to execute the entire query. Quote Link to comment https://forums.phpfreaks.com/topic/225052-dater-function-not-working/#findComment-1162357 Share on other sites More sharing options...
Minklet Posted January 20, 2011 Author Share Posted January 20, 2011 I did this, which I found. gmdate('D, d M Y H:i:s \G\M\T', strtotime($row[7])) When I go through an optimise my queries next week I'll use DATE_FORMAT Thanks Quote Link to comment https://forums.phpfreaks.com/topic/225052-dater-function-not-working/#findComment-1162359 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.