I’ve made a function to grab an RSS feed and I’m displaying it, however, each time I come across a date, the RSS uses ‘2010-03-27T22:38:32Z’, for example.
I have no idea how to turn that into something more readable. Any help?
Also, on the feed, I get codes like ‘…’, however it turns into ‘â€¦’ once displayed on the screen. I’m using SimpleXML, and I was wondering if there was a function to convert it back into normal characters? Cheers
For the time period formatting, see the user comments for an idea of how it’s done http://www.php.net/manual/en/function.time.php (use browser find in page feature, search for occurances of “minute”)
You basically find the difference in seconds between a time, and the current time. You then find the largest(or smallest) interval that it fits into.
The browser should be able to display an html character entity like …
I bet your script doesn’t actually output that character entity(check, view the html source).
Things get complicated once you want to start displaying non ascii characters. There is no simple way. Aggregating data from other websites into your own complicates things. If it’s important that you get it right, you really should consider reading up on character sets, character encodings, and unicode. It will take some effort.
If you’re looking for a quick fix that only works sometimes, pass the string through htmlentities().
Perfect. I found a user-created function that works perfectly!
Yeah, you were right. It was only until I defined a charset that the browser displayed the characters correctly… I was testing it the script on a separate page, with nothing declared in the <head>, lol…