I want to map datetime in c# datetime in protobuf . Do you have any suggestion to do this?
How do I convert from 'Google.Protobuf.WellKnownTypes.Timestamp to 'System.DateTime'
Asked Answered
Did you try to reach the documentation? –
Czechoslovak
Yes but I didn't reach a conclusion, Do you any resources about it ? –
Islas
Can you post the links to the documentation you have read and also add some code lines on the conversion, this way others can help you check for issues. –
Balliol
If you mean the Google implementation: quite simply, FromDateTime
and ToDateTime
Google.Protobuf.WellKnownTypes.Timestamp protoTimestamp
= Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(DateTime.Now);
(I add that qualification because protobuf-net also defines similarly named types, which have implicit conversion operators to/from DateTime
)
tnx for your help –
Islas
Use this nuget:
Mapster.Protobuf.extension
It adds protobuf mappings to mapster
© 2022 - 2024 — McMap. All rights reserved.