Hi,
I have a data displaying in DataGridView. Among those few columns are having DATE columns where i need to change the format from MM/DD/YYYY to DD/MM/YYYY and DD/MM/YYYY to MM/DD/YYYY .
I have created a button in FORM1. After clicking FORM1 (button), Another form opens where i have to select the column from the dropdown and click on OK. Form2 should close and Date format for selected should change in FORM1.
Please help me on this. Below is the code:
private void button3_Click(object sender, EventArgs e)
{
Date_Format df = new Date_Format();
df.cmbColumns.DataSource = cmbList;
df.ShowDialog();
string iString = df.cmbColumns.SelectedValue.ToString();
System.Globalization.CultureInfo.GetCultureInfo("en-GB");
DateTime oDate = DateTime.ParseExact(iString, "dd/MM/yyyy hh:mm:ss", System.Globalization.CultureInfo.CurrentCulture);//
MessageBox.Show(oDate.ToString());
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manas MohapatraPosted Jan 25, 2016, 6:59 AM