Clint Simon
  • @clintsim
  • All Posts

MongoDB

csim.dev

MongoDB

MongoDB .Net Driver date handling

I ran into an interesting situation when saving dated to MongoDB using the Mongo .Net driver (version 2.0). When saving a date with unspecified kind, the driver converts the date to a universal datetime. It appears that the driver will assume that a DateTime object with an unspecified kind is a local time, and convert it to universal time (UTC) before committing it to the database. In my particular case, my origin date was UTC and was read from SQL server.

27 July 2015 • 1 min read
Clint Simon © 2015
Latest Posts Twitter Github