Click here to Skip to main content
16,018,006 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in this code:
C#
var db = new TransportLINQDataContext();
TransGrid.DataSource = db.Transports;

I store Date fields in yyyy/MM/dd Format in my table
by defining Datasource Date field shows in MM/dd/yyyy format
in rows of grid.
How change theme to my desire format(yyyy/MM/dd)?
Posted
Updated 5-Jan-12 22:36pm
v2

Hi,
Use this link to get proper solution for your answer;
http://www.sql-server-helper.com/tips/date-formats.aspx[^]
 
Share this answer
 
Try this
Convert.ToDateTime(rdpDateFrom.SelectedDate).ToString("yyyyMMdd")
 
Share this answer
 
Try this
Convert.ToDateTime(rdpDateFrom.SelectedDate).ToString("yyyyMMdd")

and this to convert the date time to string with your special format
string CurrentTime = " " + DateTime.Now.ToString("ddMMyyyy HHMMs")
 
Share this answer
 
Try this
Convert.ToDateTime(rdpDateFrom.SelectedDate).ToString("yyyyMMdd")

and this to convert the date time to string with your special format
string CurrentTime = DateTime.Now.ToString("ddMMyyyy")
 
Share this answer
 
C#
TransGrid.Columns[2].DefaultCellStyle.Format = "yyyy'/'MM'/'dd";
 
Share this answer
 
v2

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