How to compare DateTime?


datetime bday = new datetime(2012, 12, 31);  datetime b = new datetime(2013, 1, 1);  console.writeline((bday>b).tostring());

as far see, output "true" because today-bday larger of result "today-b"

but result fights me!!! it's false……

why?

it seems microsoft compares datetime according year,month , day number's larger or smaller? why???

it compares dates in chronological order. day ’31 dec 2012’ occurred before ‘1 jan 2013’, therefore first date less second one.

do need kind of comparison?




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

RFC_ERROR_SYSTEM_FAILURE with SAP ECC 6 Unicode

C# System.Data.Common DbCommand and getting Datasets from Oracle