-
Type: Bug
-
Resolution: Done
-
Priority: Blocker - P1
-
None
-
Affects Version/s: 1.8.1
-
Component/s: None
-
Environment:Windows 7 Professional 64-bit. Visual Studio 2010 SP1. .Net Framework 4.0. Central Time Zone.
-
Major Change
The following code will convert both dates to UTC, but with the same hour! This output is produced:
2:52:26 AM (Notice the hour)
3:05:26 AM (Notice the hour)
2013-03-10T08:52:26Z (shows wrong hour. Should be 7, not 8)
2013-03-10T08:05:26Z (this is correct)
public class TestDateSerialize
{
public DateTime EntryDtTm
public DateTime ExitDtTm { get; set; }
}
public void testSerializeDateTime()
{ var obj = new TestDateSerialize(); obj.EntryDtTm = Convert.ToDateTime("3/10/2013 02:52:26"); obj.ExitDtTm = Convert.ToDateTime("3/10/2013 03:05:26"); var doc = obj.ToBsonDocument(); Console.WriteLine(obj.EntryDtTm.ToLongTimeString()); Console.WriteLine(obj.ExitDtTm.ToLongTimeString()); Console.WriteLine(doc["EntryDtTm"].AsBsonValue); Console.WriteLine(doc["ExitDtTm"].AsBsonValue); }