Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
980 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...