I want to add a date/time, created in PHP, to MySQL that is valid in a RSS Feed.
I'm using in PHP
$d = date( 'Y-m-d H:i:s T', time() );
$mysqldate = gmdate(DATE_RSS, strtotime($d));
inserting that into a DATETIME field in my database
But it saves it in this format Wed, 02 Oct 2002 08:00:00
and it need to be in this format to be RFC-822 valid Wed, 02 Oct 2002 08:00:00 EST
Use DATE_RFC822
instead of DATE_RSS
Why are you converting a php date time to a string, then converting that string back into a datetime object again? that's a serious waste of cpu cycles. why not simply do
$mysqldate = gmdate(DATE_RSS, time())?
as well, gmdate generates a UTC timestamp, for which there is no timezone - it's always GMT+0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With