MongoDB GMT time in C#

Posted in MongoDB, C#, on 6/8/2014

Save DateTime as GMT time to mongo DB

You can set the UTC Date in property level and set when insert.

Property Attribute to save time as UTC

[BsonDateTimeOptions(Kind = DateTimeKind.Utc)] public DateTime UpdateDate { get; set; }

Save Date when Insert to MongoDatabase.

table.CreateDate = DateTime.UtcNow;


Reference about GMT