Search

In the process of bringing in an external RSS feed to Symphony, I wanted to utilize the great date utility that Symphony has to show the dates all nice and pretty. The default date utility takes an ISO date format, 2009-04-01 and off that you can convert it to April 1, 2009 or whatever you want. Well, I needed to take the external date format, RFC 2822 datetimestamp (Wed, 1 Apr 2009 12:00:00 GMT) and convert it to the ISO format so I could use the great date-time utility that is provided for us by default.

Well, I came up with this little utility that converts the RFC 2822 datetimestamp to the ISO date format so you can utilize the date-time utility that comes with the default workspace.

Here's my little utility. I hope it's a help to some of y'all...

Oh... I use this by importing it to my current date-time.xsl utility. That way it is available to you when you call the date-time utility.

Also, if y'all don't mind, please let me know if this can be done more efficiently. Thanks. Again, I hope this utility is helpful to some.

I'm also in need of this. Thanks for posting it. I'm curious though, why are you substring()'ing it twice: once to get the date, and again to get the part. It seems redundant.

I made a fork of yours with a few changes: gist.github.com/92057

Is there a way I can make it respect timezone as well if present? Example: "Fri, 03 Apr 2009 11:49:51 -0700"

@sirlancelot, i was thinking the same thing. with twitter date formatter attempt, there was a serious flaw in that there were different time sources, one of which I did not actually know about. i think this is a better alternative, but this one also lacks the "day of the week" since it only returns the actual date.

Well, I came up with this little utility that converts the RFC 2822 datetimestamp to the ISO date format so you can utilize the date-time utility that comes with the default workspace.

The symphony built-in date-time formatter handles the day-of-week.

but if you are grabbing an external RSS feed, it won't be in the same format that symphony's date-time utility is in. the default utility asks for an attribute for both the time and the day of the week:

<xsl:with-param name="time" select="$date/@time"/>

<xsl:with-param name="weekday" select="$date/@weekday"/>

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details