Emmmanuel FIADUFE

Emmmanuel FIADUFE

  • 693
  • 1.1k
  • 55.5k

Date format appear in awkward way

May 16 2024 9:27 PM

Hello Team,

In my window application which my date data type is date for this column FDate appears in an awkward way for me because I am expecting the date appear like 22/01/2024 but has hadded time to it as listed below 

20/01/2024 12:00:00 am
21/01/2024 12:00:00 am
22/01/2024 12:00:00 am
23/01/2024 12:00:00 am
24/01/2024 12:00:00 am
25/01/2024 12:00:00 am

and this is my query

 public void LoadVisitors()
        {
            dataGridView5.Rows.Clear();
            int i = 0;
            cn.Open();
            cm = new SqlCommand("select * from tblFirstTimers where FName like '" + txtSearchF.Text + "%'", cn);
            dr = cm.ExecuteReader();
            while (dr.Read())
            {
                i++;
                dataGridView5.Rows.Add(i, dr["id"].ToString(), dr["FDate"].ToString(), dr["FName"].ToString(), dr["LName"].ToString(), dr["FGender"].ToString(), dr["FDOB"].ToString(), dr["FLocation"].ToString(), dr["FPhoneNo"].ToString(), dr["FInvitedBy"].ToString(), dr["Staying"].ToString(), dr["InviteesNo"].ToString(), dr["FPrayerRequest"].ToString());
            }
            dr.Close();
            cn.Close();
        }


Answers (3)