2

I am trying to format the dates correctly in Sharepoint Designer.

This line of code does work but I am getting spurious results as my dates are in UK formatting.

<xsl:value-of
      select=
"number(ddwrt:DateTimeTick(
            ddwrt:GenDisplayName(string(FormatDate(@DateSent,2057,1)))))-
 number(ddwrt:DateTimeTick(
            ddwrt:GenDisplayName(string(FormatDate(ddwrt:Today(),2057,1)))))"
/>

The error that I am getting is:

FormatDate is not a valid XSLT or XPath function.

Thanks in advance.

Lundin
  • 195,001
  • 40
  • 254
  • 396
moonweazel
  • 79
  • 1
  • 9

1 Answers1

0

There is no function FormatDate(...) in the XPath standard. Sharepoint Designer has one which is in the ddwrt: namespace you used for some other functions. For calling this, add the namespace.

number(ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(ddwrt:FormatDate(string(@DateSent,2057,1))))))
-
number(ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(ddwrt:FormatDate(ddwrt:Today(),2057,1)))))"
Jens Erat
  • 37,523
  • 16
  • 80
  • 96