windows 您如何为每个用户设置时区设置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4454349/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can you set time zone setting per user?
提问by James Carnley
Is there a way to set the time zone information to be unique for each Windows user? Like, a registry setting specific to that user.
有没有办法为每个 Windows 用户设置唯一的时区信息?例如,特定于该用户的注册表设置。
For example, I want John to be CST and Mary to be PST. If John opens a program it says 5pm. If Mary opens a program it says 6pm.
例如,我希望 John 是 CST,而 Mary 是 PST。如果约翰打开一个程序,它会显示下午 5 点。如果玛丽打开一个程序,它会显示下午 6 点。
Additional information: These users don't need to actually log in. I want to create two users, one for CST and one for PST, and use their credentials to run a program. The program will inherit their time zone settings and display the correct time.
附加信息:这些用户不需要实际登录。我想创建两个用户,一个用于 CST,一个用于 PST,并使用他们的凭据运行程序。该程序将继承其时区设置并显示正确的时间。
More info: I plan on using these users in IIS for app pools so that different applications in the website can be run in different time zones and locales.
更多信息:我计划在 IIS 中将这些用户用于应用程序池,以便网站中的不同应用程序可以在不同的时区和区域设置中运行。
Thanks.
谢谢。
回答by sysadmin1138
The only way Windows supports this is through Terminal Services, which won't help you. The time-zone settings are kept in the HKLM hive, and Terminal Services has a special setting that allows the Terminal Server to take a time-zone supplied by the incoming client-session and display that instead.
Windows 支持此功能的唯一方法是通过终端服务,这对您没有帮助。时区设置保存在 HKLM 配置单元中,终端服务有一个特殊设置,允许终端服务器采用传入客户端会话提供的时区并显示它。
A better plan would be to use the timezone offsets in your code. StackOverflow is a better place to ask about that.
更好的计划是在代码中使用时区偏移量。StackOverflow 是询问这个问题的更好地方。
回答by Wayne
I haven't tried, but perhaps via cygwin you can use the TZ Environmental variable like under Unix/Linux. Env variables can be set on the command line by placing them before the command called - eg TZ=UTC xxxx
.
我没试过,但也许通过 cygwin 你可以像在 Unix/Linux 下一样使用 TZ 环境变量。可以在命令行上设置环境变量,方法是将它们放在名为 -eg 的命令之前TZ=UTC xxxx
。