Represent exact representation of no time in C#


Use the TimeSpan.Zero to represent the exact representation of no time i.e −

00:00:00

Set an object for TimeSpan −

TimeSpan ts;

Now, the TimeSpan.Zero is used to display no time −

TimeSpan ts = TimeSpan.Zero;

Example

 Live Demo

using System;
using System.Linq;
public class Demo {
   public static void Main() {
      TimeSpan ts = TimeSpan.Zero;
      Console.WriteLine(ts);
   }
}

Output

00:00:00

Updated on: 22-Jun-2020

33 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements