use the Compare() method to compare DateTime instances : Date Time : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Date Time »

 

use the Compare() method to compare DateTime instances








    
 
using System;

class MainClass {

    public static void Main() {
        DateTime myDateTime = DateTime.Now;
        DateTime myDateTime2 = DateTime.UtcNow;
        DateTime myDateTime3 = new DateTime(2004, 1, 13);
        DateTime myDateTime4 = new DateTime(2004, 1, 14);
        Console.WriteLine("myDateTime3 = " + myDateTime3);
        Console.WriteLine("myDateTime4 = " + myDateTime4);
        int intResult = DateTime.Compare(myDateTime3, myDateTime4);
        Console.WriteLine("DateTime.Compare(myDateTime3,myDateTime4) = " + DateTime.Compare(myDateTime, myDateTime2));

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Date Time