确定星期开始什么日子的一周 [英] Determine what day of week the week starts with

查看:125
本文介绍了确定星期开始什么日子的一周的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定本周在当前区域设置启动什么日子?我psumably通过需要这在C,$ P $的<&time.h中GT; 头。谢谢你。

How can I determine what day the week starts with in the current locale? I need this in C, presumably via the <time.h> header. Thanks.

推荐答案

区域设置不携带该信息。这是因为什么手段一周的第一天,取决于应用程序(上的每个的应用程序),不会在计算机上。

Locales don't carry that information. That's because what "first day of the week" means depends on the application (on each application), not on the computer.

我在哪里工作,某些应用程序把星期一作为一周的第一天,和其他人把星期日作为一周的第一天。华尔街这里日历全部采用星期日作为第一天;制造日历通常使用星期一。

Where I work, some applications treat Monday as the first day of the week, and others treat Sunday as the first day of the week. Wall calendars here all use Sunday as the first day; manufacturing calendars usually use Monday.

在Windows上,使用GetLocaleInfo(),但语言环境可以在运行时进行更改。它可以通过Windows API来设置。 GetLocaleInfoEx()有更详细的文档。它看起来像SetLocaleInfo()可以改变独立于其他区域设置一周的第一天。

Under Windows, use GetLocaleInfo(), but the locale can be changed at run time. It can be set through the Windows API. GetLocaleInfoEx() has more detailed documentation. It looks like SetLocaleInfo() can change the first day of the week independent of other locale settings.

在Linux下,也有用于识别区域设置实用的一周的第一天的规定。 (人5区域区域设置文档的在线。搜索LC_TIME)。它记录为符合POSIX.2,ISO / IEC 14652

Under Linux, there are provisions for identifying the first day of the week in the locale utility. (man 5 locale, or locale docs online. Search for "LC_TIME".) It's documented as conforming to POSIX.2, ISO/IEC 14652.

$ locale day
Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday

在我的语言环境的一周的第一天是星期天。

First day of the week in my locale is Sunday.

我还没有能够找到一个系统调用或库调用它。我没有源$ C ​​$ C派上用场了。

I haven't yet been able to find a system call or library call for it. I don't have the source code handy.

这篇关于确定星期开始什么日子的一周的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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