将日期设置为UTC的问题自动设置
我有一个系统,可以从PostgreSQL DB中获取数据并将其写入SQL Server 2012。双方的字段名称均相同。 PostgreSQL作为SaaS解决方案的一部分交付。 (我只读取对DB的访问。)
对象是从dapper选择并交给插入器插入物的。我有几个字段是日期时间,当它们存储在SQL DB中时,它们会自动移动到UTC。我该如何停止?我需要该字段来表示当地的时间。我知道将所有内容存储在UTC中是最佳实践,但是要求在双方都具有相同的价值。
PostgreSQL中的字段类型是带有时区的时间戳,SQL Server端是DateTime2。
该应用程序使用Dapper版本2.0.123,并使用.NET Core 3.1。 (这是Windows服务。)
TLDR;从PostgreSQL提取数据并将其保存到SQL Server 2012时,日期和时间字段将自动转换为SQL Server上的UTC。我该如何停止?
I have a system that pulls data from a PostgreSQL DB and writes it to SQL Server 2012. The field names are the same on both sides. PostgreSQL is delivered as part of a SaaS solution. (I only have read access to the DB.)
The object is created from the dapper select and handed to a dapper insert. I have a couple of fields that are Date time, when they are stored in the SQL DB they are moved from BST to UTC automatically. How do I stop this? I need the field to represent the time in local time. I know storing everything in UTC is best practice but the requirements are to have the same value on each side.
The field type in PostgreSQL is TIMESTAMP WITH TIMEZONE and the SQL server side is DATETIME2.
The application is using Dapper version 2.0.123 and is using .Net Core 3.1. (It is a Windows Service.)
TLDR; When extracting data from PostgreSQL and saving it to SQL Server 2012 the date and time fields are automatically converted to UTC on the SQL Server. How do I stop this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论