Using ExsltDatesAndTimes parsedate Options
HFloyd
Posted: Friday, February 29, 2008 10:22:15 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 206
Location: New York, NY, USA

Hi, I am trying to use Exslt.ExsltDatesAndTimes:parsedate in my XSLT file, but I can't seem to get the right syntax for the second argument. I have tried all of the following without it returning any values:

Code:

    <xsl:variable name="ES_M" select="Exslt.ExsltDatesAndTimes:parsedate($EventDateStart, Exslt.ExsltDatesAndTimes:gMonth)"/>
    <xsl:variable name="EE_M" select="Exslt.ExsltDatesAndTimes:parsedate($EventDateEnd, 'MM')"/>
    <xsl:variable name="ES_D" select="Exslt.ExsltDatesAndTimes:parsedate($EventDateStart, '---DD')"/>
    <xsl:variable name="EE_D" select="Exslt.ExsltDatesAndTimes:parsedate($EventDateEnd, 'gDay')"/>    


Does anyone know what I should use as the second argument to return the month or the day?

Thanks,

Heather

Whole Web Impact | Floyd Innovations LLC | Heather Floyd's Blog
drobar
Posted: Friday, February 29, 2008 11:38:39 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
Hi, Heather,

I haven't looked into your specific question (meaning, I've never used the function you're talking about), but maybe there's another way to skin the cat... umbraco.library:FormatDateTime(). It takes a param to specify the format of the date/time that is very flexible.

Here's an example of it in use for sorting, seems like it could be used just as easily for variables. http://forum.umbraco.org/20383


Info on the params are at http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/FormatDateTime

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
HFloyd
Posted: Saturday, March 01, 2008 8:30:49 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 206
Location: New York, NY, USA
Hi Doug,

Thanks for the idea. I never thought of using the format function to get just a single part of a date, but possibly that works. I did figure out an alternative way - using monthinyear and dayinmonth:


Code:
    <xsl:variable name="ES_M" select="Exslt.ExsltDatesAndTimes:monthinyear($EventDateStart)"/>
    <xsl:variable name="EE_M" select="Exslt.ExsltDatesAndTimes:monthinyear($EventDateEnd)"/>
    <xsl:variable name="ES_D" select="Exslt.ExsltDatesAndTimes:dayinmonth($EventDateStart)"/>
    <xsl:variable name="EE_D" select="Exslt.ExsltDatesAndTimes:dayinmonth($EventDateEnd)"/>    


I would still be interested to know how to use parsedate, though, since it could still be useful for something else in the future...

Thanks again,

Heather

Whole Web Impact | Floyd Innovations LLC | Heather Floyd's Blog
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.