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.

Recommended Answers

All 4 Replies

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.

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

Thanks for your suggestion.

This thread is two years old.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.