c# - How to change the format of a Date within gridview? -


enter image description here

i'd change date column in gridview dd-mm-yyyy , space time @ end in format of 00:00:00

the name of column thedate , column number 2 i've tried datagridview1[2]["thedate"].tostring("dd/mm/yyyy");

 string str = datagridview1[2]["thedate"].tostring("dd.mm.yyyy");  datetime dt = datetime.now;        string formated = datagridview1.columns[2].tostring("dd.mm.yyyy");   string formated = string.format("{0:dd.mm.yyyy}", datagridview1.columns[2]); 

and none of them work i'm not sure go here!

i think problem

 datagridview1[2]["thedate"].tostring("dd.mm.yyyy"); 

this code not datetime instance.

first convert datagridview1[2]["thedate"] datetime use tostring("dd.mm.yyyy");

on it. work.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -