[英]DateTimeOffSet usage for current date
I have date field in database with 'datetimeoffset(7)'.我在数据库中有带有“datetimeoffset(7)”的日期字段。 It looks like看起来像
2021-09-30 02:00:31.3000000 +00:00.
As I understand it uses this structure:据我了解,它使用以下结构:
YYYY-MM-DD hh:mm:ss[.nnnnnnn] [{+|-}hh:mm]
I've tried this but "Now" is underlined:我试过这个但是“现在”有下划线:
var currentDate = DateTimeOffset.Now("YYYY-MM-DD hh:mm:ss[.nnnnnnn] [{+|-}hh:mm]");
How can I get current date with this date structure?如何使用此日期结构获取当前日期?
I belive this is format what you need:我相信这是您需要的格式:
var currentDate = DateTimeOffset.Now.ToString("yyyy-MM-dd hh:mm:ss.fffffff zzz");
https://stackoverflow.com/a/63242998/8825020 https://stackoverflow.com/a/63242998/8825020
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.