更新时间:2022-06-13 15:42:59
你需要将你的数据转换成TimeSpan,然后使用格式:"hh:mm"
You need to convert your data to TimeSpan and then use format:"hh:mm"
string test ="08:00:00";
TimeSpan ts = TimeSpan.Parse(test);
Console.Write(ts.ToString(@"hh:mm"));
在你的情况下:
var test = dataRow.Field<TimeSpan>("fstart").ToString(@"hh:mm"));
记得转义冒号:
您可能会看到:自定义时间跨度格式字符串