i am inserting date dd/mm/yyyy, 01/08/2019 then it is getting saved 08/01/2019.
datatype is datetime and insert code below
protected void Save(object sender, EventArgs e)
{
string jdate = Request.Form[txtjdate.UniqueID];
string ldate = Request.Form[txtldate.UniqueID];
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "[AddUpdateEmpMaster]";
cmd.Parameters.AddWithValue("@EnrollNumber", txtEmpID.Text);
cmd.Parameters.AddWithValue("@EmpName", txtEmpName.Text);
cmd.Parameters.AddWithValue("@FatherName", txtFahterName.Text);
cmd.Parameters.AddWithValue("@CNIC", txtCNIC.Text);
cmd.Parameters.AddWithValue("@Secid", ddlSecID.SelectedValue);
cmd.Parameters.AddWithValue("@Status", ddlstatus.SelectedValue);
cmd.Parameters.AddWithValue("@joindate", jdate);
cmd.Parameters.AddWithValue("@leftdate", ldate);
cmd.Parameters.AddWithValue("@cell", txtcell.Text);
cmd.Parameters.AddWithValue("@Address", txtaddress.Text);
if ((jdate == ""))
{
cmd.Parameters["@joindate"].Value = DBNull.Value;
}
else
{
cmd.Parameters["@joindate"].Value = (jdate);
}
if ((ldate == ""))
{
cmd.Parameters["@leftdate"].Value = DBNull.Value;
}
else
{
cmd.Parameters["@leftdate"].Value = (ldate);
}
GridView1.DataSource = this.GetData(cmd);
GridView1.DataBind();
}
}