Forum Moderators: coopster
We have conbbled together and hacked away at a few open source php scripts to produce a working web page that displays the latest news items from a group of RSS feeds (An aggregated feed) by recency, then deletes them after a few days. It does this by parsing rss feeds, placing the data in a simple text database, and then reading that database, sorting and deleting and adding as the page is viewed.
I can work out how to retrieve text info such as the article titile and date, URL and description and display it as an item on the page.
Now one of the fields in the database is a long string of digits which documentation says in unix time and the internal script uses this to sort items by recency.
What i would like to do is to convert that "UNIX time" field into a readable date such as "May 9th 2003 3:20pm" so as well as the headline, link and description i can also say "Indexed May 9th 2003 3:20pm"
Can anybody direct me to a good specific resource, such as the page in a php manual which described how to do this in common english? or if its simple maybe contribute a "snippet" here.
Thanks
e.g. echo date("d/m/Y",123124124);
which would produce something like
12/05/2003
( where 123124... is your unix timestamp )
if you have a unix timestamp already then making it into a readable date is very simple, only one function.
strftime [php.net]
May 9th 2003 3:20pm can be constructed like so
you assign the unix timestamp to a var
$indexed = var_from_db;
$realtime = strftime("%B %d %Y %r",$indexed);
think the pattern is right but the link will show you all of the possibilities.