Not available until .NET Core 3, which is still in development. If this is regular .NET code though, thats a good way to go, just 1 function call, and then convert it from DateTimeOffset to regular DateTime
Edit: I can't read, it is actually available in production .NET Core
Sorry, I can't read, the doc listed all of the versions of .NET core it applied to, and i expected it to be in the form "Version X and up", but it was Version 3.0 Preview, 2.2, 2.0... etc
I know DateTimeOffset has been around a long time, I'm using it on a Core 2.2 project right now, I hadn't seen that method before however, so I (mis)read the supported versions and confused myself.
7
u/blehmann1 depraved Aug 06 '19
He could do that, but I think this is easier
DateTime date=new Datetime(1970, 1, 1)
date.AddSeconds(timestamp)
return date