Ian La Flair Ian La Flair - 3 months ago 48
C# Question

parse timespan to string c#

I got stuck on converting

, in sql server jamulai column datatype is

private void btntambah_Click(object sender, EventArgs e)
int kodejadwal = Int32.Parse(txtkode.Text);
string hari = txthari.Text;
TimeSpan jamulai = new TimeSpan (txtjam.Text);
string jamselesai = txtjam2.Text;

this.jadwalPraktekTableAdapter.Insert(hari, jamulai, jamselesai);

  1. Please read documentation for TimeSpan: Here
  2. And custom TimeSpan to string formatting : Here

Simply follow the documentation of TimeSpan and put in the format that you require.