Stream: dotnet
Topic: How do I convert Date to .NET DateTime?
Yunwei Wang (Apr 21 2017 at 14:13):
For the FhirDateTime, I can use ToDateTimeOffset().DateTime to convert FhirDateTime to .NET DateTime. But I don't see similar function for Date. Do I have to use .NET DateTime.Parse() function?
Michel Rutten (Apr 23 2017 at 14:16):
Hi @Yunwei Wang FHIR defines some specialized rules for date/time types, e.g. partial values, that don't map 1-1 to (the default semantics of) C# datatypes. .NET FHIR API support is mainly focused on ensuring proper roundtripping, so e.g. FHIR Date is mapped to string. Depending on your use case, you may have to perform some manual transformations.
Brian Postlethwaite (Apr 26 2017 at 01:54):
https://github.com/ewoutkramer/fhir-net-api/blob/master/src/Hl7.Fhir.Core/Support/DateExtensions.cs
Yunwei Wang (Apr 26 2017 at 17:19):
Thanks @Brian Postlethwaite. Is this in DSTU2 nuget package?
Brian Postlethwaite (Apr 26 2017 at 20:43):
I believe so.
Yunwei Wang (May 01 2017 at 19:40):
Looks like not in Nuget 0.92.1
Last updated: Apr 12 2022 at 19:14 UTC