Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
VB
how i do create a datagridview cell like date format .
like "dd/mm/yyy"
Posted
Comments
Marcin Kozub 2-Dec-14 4:38am    
What technology: Winforms, WebForms?

 
Share this answer
 
Hi,

If this is a WinForms you can use CellFormating event:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting%28v=vs.100%29.aspx[^]

You can set column format using designer:
1. Right click on your DataGridView control
2. Select: Edit columns option
3. On columns list select column that you want to format
4. On column's property edit DefaultCellStyle
5. Set Format property

More info here: http://msdn.microsoft.com/en-us/library/vstudio/95y5fz2x%28v=vs.100%29.aspx[^]

Cheers!
 
Share this answer
 
use dataformatstring

<asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" />
 
Share this answer
 
C#
<![CDATA[<%#Eval("CREATED_ON", "{0:dd/M/yyyy}")%>]]>'


see this ..

Grid view bound field format..
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring(v=vs.110).aspx[^]
 
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