I got the following formate returned from "Write" in english:


I parse that with the following line and return a german format: 12. Sep.

<xsl:value-of select="ddwrt:FormatDateTime(string(write),1031, 'd. MMM.')"/>

If i now change the regional settings to german i get the following result in the SCR


but the german format that comes back is 9. Dez (9.12.2012) ...

How can i fix that?

  • What is the unformatted date after changing the regional settings to german? This function relies on ISO8601 format yyyy-mm-ddThh:mm:ssZ.
    – Hugh Wood
    Commented Sep 12, 2012 at 8:47
  • As i wrote, the date changes from 09/12/2012 to 12.09.2012 -> Its already regionalformated and no raw iso Commented Sep 12, 2012 at 11:24
  • Okay I understand, try this solution: social.technet.microsoft.com/Forums/is/…
    – Hugh Wood
    Commented Sep 12, 2012 at 12:15
  • What a bullsh*t... Why does it only recognise english time format? It has '.''s .. How does it interpret 12.09.2012 to 12/09/2012 ?! WHY!? ... Well done MS .. What happens now if someone changes the format back to english and i do substring? I would have a wrong date again.. I dont wanna do this for every possible region. Commented Sep 14, 2012 at 11:44
  • Nice fix, please post your code, as the solution so others can benefit.
    – Hugh Wood
    Commented Nov 6, 2012 at 8:44

1 Answer 1


Fixed it with recognising if time has dots.If so then just took the values of dd, mm and yyyy and rebuilded the string then ..

<xsl:variable name="date">
    <xsl:call-template name="TransformDate">
        <xsl:with-param name="String" select="write"/>

<b class="smalldate">
    <xsl:value-of select="ddwrt:FormatDateTime(string($date),1031, 'd. MMM.')"/>

<xsl:template name="TransformDate">
    <xsl:param name="String"/>
      <xsl:when test="contains($String, '.')">
        <xsl:value-of select="substring($String, 4,2)"/>
        <xsl:value-of select="'/'"/>
        <xsl:value-of select="substring($String, 1,2)"/>
        <xsl:value-of select="'/'"/>
        <xsl:value-of select="substring($String, 7,4)"/>
        <xsl:value-of select="$String"/>

Does something like "06. Nov." no matter if region was set to english, or german (and i guess all the other countries with dateformat dd.mm.yyyy). Now you can easily switch to another dateformat (thanks to ddwrt).

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.