Convert TimeSpan From Format "hh:mm:ss" To "hh:mm"
Answer : 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")); In your case: var test = dataRow.Field<TimeSpan>("fstart").ToString(@"hh\:mm")); Remember to escape the colon : You may see: Custom TimeSpan Format Strings There is no need to convert from hh.mm.ss to hh.mm . TimeSpan is stored as a number of ticks (1 tick == 100 nanoseconds) and has no inherent format. What you have to do, is to convert the TimeSpan into a human readable string! This involves formatting. If you do not specify a format explicitly, a default format will be used. In this case hh.mm.ss . string formatted = timespan.ToString(@"hh\.mm"); Note: This overload of ToString exists since .NET 4.0. It does not support date and time placeholder separator symbols! Therefore you must include them as (escaped) string literals. The usu...