SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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')"/>
share|improve this answer
Note that SharePoint still uses the XSLT 1.0 spec (as of SharePoint 2010) so XSLT 2.0 functionality won't help. – Marc D Anderson Jul 10 '12 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.

share|improve this answer
Thanks everyone – Mighty Jul 9 '12 at 14:04
@Mighty it's customary to mark one correct answer as the accepted answer. – David Clarke Mar 7 '13 at 23:32
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 at 2:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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