确定区域工作日和一周中的周末
在某些国家/地区,周末是周五/周六。
Windows 应用程序如何找出用户的周末?
In some countries weekend days are Friday/Saturday.
How can a Windows application find out weekend days of the user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嗯……我不知道这个问题有“一个函数”的答案。你需要以某种方式知道他们在哪里。如果是网络应用程序,您可以追踪他们的 IP 并找出他们来自哪个国家/地区。如果它是 Windows 应用程序,您可能需要询问他们(时钟仅提供时区信息,我不知道还能从哪里获取更细粒度的位置)。
您可以使用 GetDayofWeek http:
如果您跳转到 .Net /en-us/library/system.dayofweek.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.dayofweek.aspx
您需要包含国家/地区/他们认为周末的日子的查找表..您可能必须构建此表,但您可以从以下位置获取国家/地区列表: http://www.iso.org/iso/english_country_names_and_code_elements
该列表是 ISO 3166。
它已更新,应该是您列表的“一站式商店”。从那里,您将“周末”与国家/地区相匹配。 http://en.wikipedia.org/wiki/Workweek 可能有助于确定周末/各国的工作周。
Wellll...I don't know of a "One function" answer to this. You're gonna need to know where they are somehow. If it's a webapp, you can trace their IP and figure out what country they are from. If it's a windows app, you're probably going to need to ask them (The clock only provides timezone information, and i can't figure out where else to grab a more fine-grained location from windows).
You can figure out what day it is with GetDayofWeek http://msdn.microsoft.com/en-us/library/1wzak8d0%28VS.80%29.aspx in MFC
DayofWeek if you hop to .Net http://msdn.microsoft.com/en-us/library/system.dayofweek.aspx
You'll need a lookup table with countries/what days they consider weekends..you'll probably have to construct this, but you can get a list of countries from: http://www.iso.org/iso/english_country_names_and_code_elements
That list is ISO 3166.
It's updated and should be your "one-stop-shop" for the listing. From there, you'll match "weekends" to the countries. http://en.wikipedia.org/wiki/Workweek might help in figuring out weekends/workweeks for countries.
以下代码将提供是否将其视为周末,并提供针对不同文化的选项(周末在不同的一天开始/结束):
The following code will provide whether or not it is considered the weekend, with an option for different cultures (where the weekend starts/ends on a different day):
ICU 项目可能会有所帮助。它是为软件国际化和全球化而设计的。提供 C/C++ 和 Java 版本。
icu-project.org
ICU project might help. It is designed for software internalization and globalization. C/C++ and Java version are available.
icu-project.org