[CSHARP-2545] The same BsonDateTime were stored different timezone Created: 14/Mar/19 Updated: 25/Jun/20 Resolved: 25/Jun/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.7.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jason Hsu | Assignee: | Wan Bachtiar |
| Resolution: | Done | Votes: | 0 |
| Labels: | Bug, rfw | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Window Client. with .NET Core 2 |
||
| Description |
|
I'm using C# Driver 2.7 and MongoDB 4.0.x. The issue I'm encounted with is about the date field. Basically, I know the date is stored in UTC. "16:22:37.661" is local time and "2019-03-12 08:22:37.661" is its equivelent UTC. How come it shows different in two places? My json looks like:
The json submitted from client contains only key and one or elements in details. The server-side upserts it and pushes (accumulates) new details into the array. Before pushing, the time stamp will be added to each element of the detail array then set the latest ts of details_ts. The issue is the ts in the last element of details looks different from details_ts. It doesn't make sense to me because I create only one BsonDateTime and use many places. They should be look exact the same no matter what's the timezone. My C# Code is like:
|
| Comments |
| Comment by Rachelle Palmer [ 25/Jun/20 ] |
|
Hi there, thank you for reaching out to MongoDB. As this sounds more like a support issue, I wanted to give you some resources to get this question answered more quickly:
Thank you! |