[CSHARP-171] DateTime bug Created: 21/Feb/11  Updated: 20/Mar/14  Resolved: 21/Feb/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 0.11
Fix Version/s: 1.0

Type: Bug Priority: Major - P3
Reporter: Suning Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When I insert datetime before 1970 or after 1970, I get different display by db.XX.find();
It displays -2147483647 when I save datetime before 1970
and display 2011 14:59:07 when i save datetime after 1970

The worst thing is that, example:

collection.Insert(new Person

{ Birthday = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc) }

);
var count = collection.Find(Query.GTE("Birthday", new DateTime(1960, 1, 1, 0, 0, 0, DateTimeKind.Utc))).Count()
count will return 0.



 Comments   
Comment by Robert Stam [ 21/Feb/11 ]

The C# driver is handling DateTime values correctly. The problems you are reporting are actually occurring in other components.

The Mongo shell has problems displaying DateTime values prior to 1970-01-01. See:

http://jira.mongodb.org/browse/SERVER-960

Also, the Mongo Server has problems doing comparisons against DateTime values prior to 1970-01-01. See:

http://jira.mongodb.org/browse/SERVER-405

Generated at Wed Feb 07 21:36:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.