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

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?

share|improve this question
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 Sep 12 '12 at 8:47
As i wrote, the date changes from 09/12/2012 to 12.09.2012 -> Its already regionalformated and no raw iso – fr34kyn01535 Sep 12 '12 at 11:24
Okay I understand, try this solution:… – Hugh Wood Sep 12 '12 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. – fr34kyn01535 Sep 14 '12 at 11:44
Nice fix, please post your code, as the solution so others can benefit. – Hugh Wood Nov 6 '12 at 8:44
up vote 0 down vote accepted

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 Now you can easily switch to another dateformat (thanks to ddwrt).

share|improve this answer

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.