如何使不使用JavaScript在ASP.Net本地给定时间UTC日期时间值? [英] How to render local time given UTC datetime values in ASP.Net without using Javascript?

查看:121
本文介绍了如何使不使用JavaScript在ASP.Net本地给定时间UTC日期时间值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能不使用JavaScript来显示本地时间给用户,当您存储值作为UTC?

Is it possible to display local times to users without using Javascript when you store the values as UTC?

推荐答案

您将需要服务器端必须知道客户端时区。没有足够的信息,在典型的请求作出的决定,你可以得到的最接近的是Accept_Language头这可能给你一个线索,但几乎没有足够有用的(尤其是如果客户是在具有多个时区的国家)

You would need serverside to be aware of the clients timezone. There isn't enough information in the typical request to make that determination, the closest you can get is the Accept_Language header which might give you a clue but is hardly useful enough (esp. if the client is in a country that has multiple timezones).

因此​​,你需要用户告诉你他们的时区是什么,然后使用登录或cookie来存储信息。

Hence you would need to user to tell you what their timezone is and then use a logon or cookie to store that info.

这篇关于如何使不使用JavaScript在ASP.Net本地给定时间UTC日期时间值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆