My Code: I have an API currently, once I get a request from the client, we save the information along with the time of the request which is DateTime.UtcNow()(this is not received from the client, we do it in my code). and save it in the couchbase.
Problem: Sometimes the DateTime field is saved with different precisions, ideally I would like to save this field with a precision upto 7 decimal points(e.g:2020-12-28T18:45:24.6901637Z) but sometimes .net is saving this time with different precisions(2020-12-28T18:49:10.02396Z).
Can someone please help me figure out why is this happening randomly. I am using .net core 3.1.
Code Sample:
var obj = new obj{empId = 111, empType = 'Contractor', status = 'Ontime', lastUpdatedTime = DateTime.UtcNow}; var id = 111;
var response = await _bucket.InsertAsync<dynamic>(id, obj);
response in couchbase: { empId : 111, empType : Contractor, status : 'OnTime', lastUpdatedTime : '2020-12-28T18:45:24.6901637Z', }, { empId : 222, empType : Contractor, status : 'Delayed', lastUpdatedTime : '2020-12-28T18:50:19.12345Z', }
I apologize for any kind of vague information i provided. please let me know if i need to put any other information which will make more sense