0 users online. Create an account or sign in to join them.Users
Current Date and Time
This is an open discussion with 6 replies, filed under XSLT.
Search
@rainerborene - Did you see Rowan’s utility which uses EXSLT?
@rainerborene - you should be able to get the current date and time from your symphony parameters ?debug=params.
Or if you want to pull the current date and time via exslt, then first you’ll want declare the exslt namespace in your xsl:stylesheet element like so…
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:date="http://exslt.org/dates-and-times" exclude-results-prefixes="date">
Here’s what you use to get the current date and time, <xsl:value-of select="date:date-time()"/>
Here’s what you use to get just the current date, <xsl:value-of select="date:date()"/>
Because the utility expects a time attribute on the date node it will fail. I get around this by first calling the format-date template with something like:
<xsl:with-param name="date" select="$today"/> <xsl:with-param name="format" select="'Y M D'"/>
Then the format-time template, splitting the $current-time parameter up.
Alternatively could you try:
<xsl:with-param name="date">
<date time="{$current-time}"><xsl:value-of select="$today"/></date>
</xsl:with-param>
@bzerangue Thanks, I’ll try that solution.
@nickdunn The format-date template also needs a weekday attribute.
@rainerborene - I made a couple of edits, see bolded items above.
@nickdunn The format-date template also needs a weekday attribute.
Only if you use the W character in the format. If you don’t need day of the week, it doesn’t need the attribute.
Create an account or sign in to comment.
Hello,
How do I show the current date and time using the Format Date/Time utility?
I’ve tried the
exslt:node-setfunction to pass a node as paramater, but didn’t work.