STR_TO_DATE Problems

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Aquilagb
Forum Newbie
Posts: 1
Joined: Tue Sep 23, 2008 2:46 am

STR_TO_DATE Problems

Post by Aquilagb »

Hello,

I am entering RSS feeds into my MySQL DB,the pubDate in the RSS feed is in this format "Tue, 23 Sep 2008 08:49:00 GMT" and I am trying to use STR_TO_DATE to enter it into the database in the correct format. Here is my query:

"INSERT INTO rss_feeds (title, description, link, pubdate) VALUES ('$ins_title','$ins_desc','$ins_link',STR_TO_DATE($pubdate, '%a, %d %b %Y T'))"

But this keeps faling with errors like this: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Sep 2008 10:22:00 GMT, '%a, %d %b %Y %T %x'))' at line 2"

What's confusing me is if I echo $pubdate I get the full date as above yet the MySQL error is missing the abbreviated day and day of the month. Any help resolving this would be appreciated.

Thanks,
Aquilagb
Post Reply