根据客户端显示当前日期时间

Display current datetime depending on client

我目前正在将 datetime.utcnow 保存在 Azure 数据库中,但我不确定如何根据客户端显示正确的时间。
我应该使用 utc 吗? 我应该保存时区以便重新计算时间吗? 我可以使用文化将时间更改为客户端时间吗?

您最好的选择是将 DateTime 存储为 UTC 时间,并在每次从数据库中读取时将其调整为本地时间(针对用户的当前位置)。

您可以使用JavaScript来确定用户的时区:

new Date().gettimezoneOffset()