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

How to Share webservice object to all user

How to fix error Msg 1801, Level 16, State 3, Line 1