Represent exact representation of no time in C#

CsharpProgrammingServer Side Programming

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
raja
Updated on 22-Jun-2020 14:10:56

Advertisements