change the way a datagridview shows dates and time


New member
Nov 15, 2013
Programming Experience
hello guys

im wandering is it possible to change the way a datagridview shows dates and time like change it into other formats in c# because currently i have dates storede like (140101 = dd/mm/yy )
so what im asking is if its possible to show 140101 as dd/mm/yy by changing the way my datagridview displays those columns ?? \

please help im stuck


C# Forum Moderator
Staff member
Apr 23, 2011
Sydney, Australia
Programming Experience
Argh! You shouldn't have dates stored in any format. You're just making life hard for yourself and everybody else. Dates should be stored as dates and then they would have no format at all. They're just numbers. By storing your data as text you are making them no longer dates at all, which makes things like sorting and searching either slower or impossible. Do you store numbers as text or as numbers? If you don't store numbers as text then why store dates as text? Because the data in the database is text, if you wanted to display the dates in a different format then you first have to convert them to actual dates because, as far as the app is concerned, they are not dates. They are no different to "Hello World" and you obviously can't format that.

So, the first option is to change your database schema to store your dates as dates. If that's possible then that's what you should do. Everything else becomes easier as a result. Can you do that?
Top Bottom