locked
Date format is not correct in the DataFormWebPart

    Question

  • Hi All,

    I would like to display the date in UK format which is DD/MM/YYYY, but not US format MM/DD/YYYY
    So I have set the regional setting in the site setting to be UK
    However, when I am using SP Designer to create DataFormWebPart to show a list.
    And the data is group by a date column
    The group value is shown like
    MM/DD/YYYY  ($fieldvalue)
    So I have changed the grouping column to be a custom formula
    ddwrt:FormatDateTime(string(@Date),3076,'dd.MM.yyyy')
    But the sorting order is not correct, it regard the result of the formula as a string.
    My question is
    Is there anyway to change the date format in
    DataFormWebPart?
    Or
    Is there anyway that can change the $fieldvalue from
    MM/DD/YYYY to DD/MM/YYYY
    I have tried ddwrt:FormatDateTime($fieldvalue,3076,'dd.MM.yyyy')
    but it is not working

    Thanks all
    Friday, July 04, 2008 10:39 AM

Answers

  • I have found out the problem what is the problem
    I have changed
    <xsl:value-of select="ddwrt:FormatDateTime($fieldvalue,3076,'dd/MM/yyyy')" />
    to
    <xsl:value-of select="ddwrt:FormatDateTime(string($fieldvalue),3076,'dd/MM/yyyy')" />

    since I am using a date to group the data, the
    $fieldtype of $fieldvalue is isodatetime
    so I need to change it to string before using
    FormatDateTime function

    Thanks Ivan for your reply
    Monday, July 07, 2008 1:58 AM

All replies

  • I dont use the data form webpart very often but when modifying the xsl for the ECQWP the following string works for the UK Date Format

     

    <xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@Modified), 3081, 5)" />

     

    In fact its the default in order to get the US Date format you have to cvhange it to

     

    <xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@Modified), 1033, 5)" />

     

     

    Hope this helps

     

     

    -Ivan

     

    http://dimension-si.com/blog

    http://linkedin.com/in/iasanders

     

     


     

    Saturday, July 05, 2008 10:20 PM
  • I have found out the problem what is the problem
    I have changed
    <xsl:value-of select="ddwrt:FormatDateTime($fieldvalue,3076,'dd/MM/yyyy')" />
    to
    <xsl:value-of select="ddwrt:FormatDateTime(string($fieldvalue),3076,'dd/MM/yyyy')" />

    since I am using a date to group the data, the
    $fieldtype of $fieldvalue is isodatetime
    so I need to change it to string before using
    FormatDateTime function

    Thanks Ivan for your reply
    Monday, July 07, 2008 1:58 AM