C# Program to Demonstrate the Use of Duration() Method of Timespan Structure

You are currently viewing C# Program to Demonstrate the Use of Duration() Method of Timespan Structure

C# program to demonstrate the use of Duration() method of TimeSpan structure

using System;

class TimeSpanDemo
{
    //Entry point of Program
    static public void Main()
    {
        TimeSpan timeSpan = new TimeSpan(-75643);
        Console.WriteLine("Absolute value of timeSpan is: " + timeSpan.Duration());
    }
}

Output

Absolute value of timeSpan is: 00:00:00.0075643
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply