如何获得在C#中当前用户时区 [英] How to get current user timezone in c#
本文介绍了如何获得在C#中当前用户时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我建设MVC3应用程序,我想这样做
当用户进入我的网站,我想知道什么用户
时区 。我想知道如何在C#中没有Java脚本做到这一点?
I am building an application in mvc3 and i want to do that when user come into my site i want to know that whats user timezone . i want to know how to do this in c# not in java script ?
推荐答案
这是不可能的服务器端,除非你通过用户的IP地址,假设它还是得到了用户将其设置为某种形式的轮廓。你可以通过JavaScript获得客户的时间。
This isn't possible server side unless you assume it via the users ip address or get the user to set it in some form of a profile. You could get the clients time via javascript.
在这里看到了javacript的解决方案:获取客户端的时区在JavaScript中
See here for the javacript solution: Getting the client's timezone in JavaScript
这篇关于如何获得在C#中当前用户时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文