Help please can anyone advise how I get current date, or today method in xslt 1.o SharePoint

2 Answers 2


I'm not sure if XSLT 1.0 have today's date method. However, XSLT 2.0 has an equivalent current-date()

Have you tried?


<xsl:value-of select="ddwrt:Today()"/>


<xsl:value-of select="ddwrt:FormatDateTime(ddwrt:Today(),1033,'yyyyMMdd')"/>
  • 5
    Note that SharePoint still uses the XSLT 1.0 spec (as of SharePoint 2010) so XSLT 2.0 functionality won't help. Jul 10, 2012 at 2:16

When you add a DVWP to the page in SharePoint Designer, SPD defined a variable which contains the current date for you in the ParameterBindings section:

<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

Be sure to declare Today as a param at the top of the stylesheet:

<xsl:param name="Today" />

Then you can use $Today however you need it.

The ddwrt:Today() function is also useful, but there's no real need for it when SPD is already handing you the value.

  • Actually, there is. Using $Today led to wrong results when comparing dates for conditional formatting. Being in NZ, I saw results change at noon, which is midnight in GMT. Maybe this does not matter for US locales, but for NZ locale I get correct results with ddwrt:today() and wrong results with $Today.
    – teylyn
    Apr 28, 2016 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.