Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

entity framework on entering a datetime 1 millisecond before the next day date is getting rounded up

I'm entering a datetime using the entity framework and I was trying to enter this date:

new DateTime(2011, 11, 18, 23, 59, 59, 999);

which is one millisecond before the 19th.

However when I check it in the database it keeps getting rounded up to the 19th 2011/11/19 0 0 0 000

Anyone know what's going on here and how to remedy it?

This is the type in my model:

public override DateTime? EndDate { get; set; }
like image 586
AnonyMouse Avatar asked Dec 21 '25 07:12

AnonyMouse


1 Answers

May be your column type on database is date? not datetime

like image 81
Reza ArabQaeni Avatar answered Dec 24 '25 12:12

Reza ArabQaeni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!