I facing an issue when retrieving date and time along with time zone in C# using couchbase SDK. Please find the details below.
This is the couchbase Insert Query which is having different country date and time along with time zone
Upsert Query
UPSERT INTO DtTest (KEY,VALUE)
VALUES ( “TZ:Dates”, {
“Tokyo” : “2020-06-18T15:26:00+09:00”,
“Beijing” : “2020-06-18T14:26:00+08:00”,
“Moscow” : “2020-06-18T09:26:00+03:00”,
“Paris” : “2020-06-18T08:26:00+02:00”,
“LosAngeles” : “2020-06-17T23:26:00-07:00”
})
This is couchbase Select Query, where we can check by using console
** Select Query**
select * from DtTest use keys “TZ:Dates”
Couchbase Select Query Result in console and we didn’t see any issue here
{
“Beijing”: “2020-06-18T14:26:00+08:00”,
“LosAngeles”: “2020-06-17T23:26:00-07:00”,
“Moscow”: “2020-06-18T09:26:00+03:00”,
“Paris”: “2020-06-18T08:26:00+02:00”,
“Tokyo”: “2020-06-18T15:26:00+09:00”
}
When we are trying to retrieving from Couchbase SDK in C#
** Couchbase SDK code in C#**
_bucket.Get<dynamic>("TZ:Dates");
Couchbase SDK Result in C# which is converting the timezone to my system local timezone
{
“Beijing”: “2020-06-18T11:56:00+05:30”,
“LosAngeles”: “2020-06-18T11:56:00+05:30”,
“Moscow”: “2020-06-18T11:56:00+05:30”,
“Paris”: “2020-06-18T11:56:00+05:30”,
“Tokyo”: “2020-06-18T11:56:00+05:30”
}
Note : Please help me on this to retrieve exact time zones how we are getting from Couchbase Console