Answered SharePoint date label shown wrong

  • Friday, April 06, 2012 8:16 AM
     
     

    Hello,

    I've made a custom view in which I have a date. However de date is shown ad <xsl-value-of node-walk="118" select="@Startdatum">2012-04-04T22:00:00Z in stead of 2012-04-04. How can I change this?</xsl-value-of>

    <xsl-value-of node-walk="118" select="@Startdatum">I've tried this code:</xsl-value-of>

    <xsl:value-of select="@Startdatum" />

    and this code

    <asp:label runat="server" id="ff7{$Pos}" text="{@Startdatum}" __designer:bind="{ddwrt:DataBind('u',concat('ff7',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Startdatum')}" />

    Both do not work.

    Any ideas?

    Remco     

    <xsl-value-of node-walk="118" select="@Startdatum"></xsl-value-of>

All Replies

  • Friday, April 06, 2012 11:44 AM
     
     

    I hove this link will solve your problem:

    http://blogs.msdn.com/b/joshuag/archive/2009/03/25/custom-date-formats-in-sharepoint-xsl.aspx

    An other option is to create a calculated field and put in the date there. Now you can control the format with a formula like : 

    =TEXT([Date];"yyyy-mm-dd");"") where ';' depends on your local setting. It can be ','. 

  • Friday, April 06, 2012 12:35 PM
     
     
    In the default list it's working but in my custom list it isn't, this forum doesn't work. If i apply this then the whole form isn't working anymore.
  • Friday, April 06, 2012 1:45 PM
     
     

    Hi,

    Could you try and select that field and format it as "Date". It should work.

    Cheers

  • Friday, April 13, 2012 12:24 PM
     
     
    I would say so but then it's not working at all. It says its not the same format.
  • Monday, April 16, 2012 10:58 AM
     
     Answered

    Change select="@Startdatum"

    to select="msxsl:format-date(@Startdatum,'MM/dd/yyyy')"

    like the following:

    <xsl:value-of  "msxsl:format-date(@Startdatum,'MM/dd/yyyy')"/>