Mysql Query = Convert Unix Timestamp to RFC 822 Date

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

#date-format #mysql #rss #timestamp

1 reply · 574 views · started 15 years ago · 1 min read

2 participants
wildfire Newbie · 1 posts #1

Hi, I'm trying to create a RSS feed and have yet to convert the timestamp into a RFC 822 date. From what I've read there is a mysql function that will convert during the retrieval. Maybe "FROM UNIXTIME" or "DATE FORMAT". Just not sure how to create a query string and put it all together. Here's my query so far.

$SQLQuery = "Select title, body, entry_id, postdate FROM my_blogs ORDER BY postdate DESC";

In my application I can't "echo" so it needs to do it while retrieving the data, if possible. Anybody help will be appreciated. Thanks

Just when I think I have learned the way to live, life changes.

something else Fellow · 2,296 posts #2
$SQLQuery = "Select title, body, entry_id, postdate FROM my_blogs ORDER BY postdate DESC";
$lists = mysql_query($SQLQuery);
    while($list=mysql_fetch_array($lists))
    {
           $date = date(DATE_RFC822,$list[3]);
    }

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close