简体   繁体   中英

How to format SQL date timestamp from Bigint to C# date

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

您需要使用DateTime ParseExact方法,例如:

var date = DateTime.ParseExact("20220504112601755", "yyyyMMddhhmmssfff", System.Globalization.CultureInfo.InvariantCulture);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM