c# - EF6 Strange Dateproblem / Context.SaveChanges messes up date -
in model have datetime object, filled webapi json string.
the model.end reads in debugger:
model.end {13.09.2016 23:59:59} system.datetime or in ticks:
model.end.ticks 636094079999990000 long then set entity enddate model.end:
appointment.enddate = model.end; store whole thing savechanges:
appointment.lastedit = datetime.now; ctx.appointments.add(appointment); ctx.savechanges(); return appointment; //breakpointset at breakpoint, appointment object reads correct date:
appointment.enddate {13.09.2016 23:59:59} system.datetime when reading ctx.appointments.tolist() in debugger, reflects correct date.
but.... when connect database, , read on appointments table, end date set to:
14.09.2016 00:00:00 what?? comes second from?
to answer own question:
model.end.ticks 636094079999990000 long is
model.end {13.09.2016 23:59:59} system.datetime but also:
model.end.millisecond 999 int and database cant handle milliseconds, skips nearest second.
Comments
Post a Comment