Pregunta

Timespan to display just the days, without hrs, min, and sec.

my time span is coming like 30.00:00:00 for 39 days. please help in vb.net code.

¿Fue útil?

Solución

Here is the TimeSpan documentation on MSDN. Assuming you start with this:

' Define an interval of 3 days, 16+ hours. 
Dim interval As New TimeSpan(3, 16, 42, 45, 750) 
Console.WriteLine(interval.Days())
Console.WriteLine(interval.ToString("dddd"))

You have two options for displaying time in days. The first is:

Console.WriteLine(interval.Days())

or you can format your time in the ToString function:

Console.WriteLine(interval.ToString("dddd"))

You would need to add as many ds as you are expecting to display or you will get an error.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top