none
incorect date value and formating on display form

    Question

  • On the list display form i have start date field which shows date in the folloving format : 2010-07-06T22:00:00Z

    First it shows the wrong date since in edit from i see 7/7/2001

    secondly the format is wrong since i choosen date only field so i don't want to see time and zone.

    Does anybody knows why this happens and how to fix it?

    Friday, October 01, 2010 11:13 AM

Answers

  • Hi,

     

         If the OOB date time field could not meet your requirement in the display form, you could create your customize control in  display form and change date format in XLST.

         Firstly, create your own control and hide the OOB one the following steps:

    ·         Open your site in SharePoint Designer, browse to the List and open the ‘DispForm.aspx’ web form.

    ·         Right-click the list form and select “Web part properties”, in the Layout section, select “Hidden”. (We should hide the original form and then create a new display form)

    ·         Go Insert > SharePoint Controls > Custom List Form.

    ·         In the List or Document Library Form dialog, select the List, content type and type of form (select display item form).

    ·         Click OK and a new form is added with controls representing all the fields from the list.

         Then you could use msxsl:format-date method in this customized form to change date format, e.g: <xsl:value-of select="msxsl:format-date(@StartDate, 'dd/MM/yyy')"/>

         Hope this can help!                                                                                                                              

            

    Best Regards,

    Aaron

    • Marked as answer by Wayne Fan Friday, October 08, 2010 6:12 AM
    Wednesday, October 06, 2010 7:28 AM

All replies

  • Hi,

     

         If the OOB date time field could not meet your requirement in the display form, you could create your customize control in  display form and change date format in XLST.

         Firstly, create your own control and hide the OOB one the following steps:

    ·         Open your site in SharePoint Designer, browse to the List and open the ‘DispForm.aspx’ web form.

    ·         Right-click the list form and select “Web part properties”, in the Layout section, select “Hidden”. (We should hide the original form and then create a new display form)

    ·         Go Insert > SharePoint Controls > Custom List Form.

    ·         In the List or Document Library Form dialog, select the List, content type and type of form (select display item form).

    ·         Click OK and a new form is added with controls representing all the fields from the list.

         Then you could use msxsl:format-date method in this customized form to change date format, e.g: <xsl:value-of select="msxsl:format-date(@StartDate, 'dd/MM/yyy')"/>

         Hope this can help!                                                                                                                              

            

    Best Regards,

    Aaron

    • Marked as answer by Wayne Fan Friday, October 08, 2010 6:12 AM
    Wednesday, October 06, 2010 7:28 AM
  • Thanks Aaron,

    just <xsl:value-of select="msxsl:format-date(@StartDate, 'dd/MM/yyy')"/> helped imediatley :) .

    Thing is, i just noticed, that the problem is more severe. Actually the date that is showing on display form is 

    Start Date 2010-07-06T22:00:00Z while the actual date is 2010/07/07. That is the date that i picked from calendar and that one is seen on edit form.

    I don't get this since both forms using the same source to get the value. Right?

     

    Wednesday, October 20, 2010 1:38 PM