Check if two DateTimeOffset objects represent the same point in time in CSharp
Description
The following code shows how to check if two DateTimeOffset objects represent the same point in time.
Example
//from w w w . j a v a 2 s . c om
using System;
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset firstTime = new DateTimeOffset(2014, 11, 15, 11, 35, 00,
DateTimeOffset.Now.Offset);
DateTimeOffset secondTime = firstTime;
Console.WriteLine("{0} = {1}: {2}",
firstTime, secondTime,
DateTimeOffset.Equals(firstTime, secondTime));
}
}
The code above generates the following result.