Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When we get date value from grid view how to convert it in to ("dd/MM/yyyy")?


if date value is from text box,we code as,
txtDate.Text=DateTime.Now.ToString("dd/MM/yyyy");


if date value is from gridview,how to code as,

i coded as,

grdsale.SelectedRow.Cells[6].Text=DateTime.Now.ToString("dd/MM/yyyy");



is it correct?


can anyone help me please....
Posted
Updated 18-Feb-13 1:46am
v2

Try like this
C#
<asp:BoundField DataField="YourDateField" HeaderText="SomeHeader"
                    DataFormatString="{0:MM-dd-yyyy hh:mm tt}"  />


Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900