如何正确计算两次间的时间差,以正确显示天数、时数、分钟数。我写的代码显示了错误的时间跨度。如我在以下图片所示:

我的代码:
private void button1_Click(object sender, EventArgs e)
{
TimeSpan ts = dateTimePicker2.Value - dateTimePicker1.Value;
textBox1.Text = ts.ToString();
string total = textBox1.Text;
string[] TotalTIme = textBox1.Text.Split('.');
textBox1.Text = TotalTIme[0];
}https://stackoverflow.com/questions/70525078
复制相似问题