Hi.., all,

I need both date and time to be displayed in my grid view in the dd/MM HH:mm format. I used dataformatstring={0:dd/MM HH:mm} but its not giving wat i need. so please can u suggest what should i do to get my problem solved.

Thanks in advance.

Hi,

You forget to set this function :
"HtmlEncode= false"

<asp:BoundField dataField="TransactionDate" HeaderText="Trans. Date" SortExpression="TransactionDate" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false"/>

Thanks,

Kusno.

Hi,

I did the same change on but the month became 00 (18/00/2008). After removing {0:mm//dd/yyyy} from DataFormatString, the month appeared again (2008-09-18 00:00:00.000) of course together with the time portion that I wish to get rid of.

Please help.

<asp:BoundField DataField="EstimateCompleteDate" HeaderText="EstimateCompleteDate"
SortExpression="EstimateCompleteDate" DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="False" />
<asp:BoundField DataField="ActualCompleteDate" HeaderText="ActualCompleteDate" SortExpression="ActualCompleteDate" DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="False" />

Thanks in advance.

Edited 3 Years Ago by happygeek: fixed formatting

Hi,

I did the same change on but the month became 00 (18/00/2008). After removing {0:mm//dd/yyyy} from DataFormatString, the month appeared again (2008-09-18 00:00:00.000) of course together with the time portion that I wish to get rid of.

Please help.

        <asp:BoundField DataField="EstimateCompleteDate" HeaderText="EstimateCompleteDate"
            SortExpression="EstimateCompleteDate" DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="False" />
        <asp:BoundField DataField="ActualCompleteDate" HeaderText="ActualCompleteDate" SortExpression="ActualCompleteDate" DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="False" />

Thanks in advance.

Hi ,
You need to use MM not mm in your string should be {0:MM/dd/yyyy}, the mm stand for minutes, thats why you get 00

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.