I need to convert dates in an SQL view from BIGINT value (format: 20220504112601755) to C# date time value (to some similar format: 2022.05.04 11:26:01) within C#.
All I found were unix epoch times and how to convert those to readable date times but not much about my issue.
Any help would be appreciated. (Didn't include any code because nothing I tried even came close to working as I wanted)
Thanks
CodePudding user response:
You need to use the DateTime
ParseExact
method e.g.:
var date = DateTime.ParseExact("20220504112601755", "yyyyMMddhhmmssfff", System.Globalization.CultureInfo.InvariantCulture);