Re: First day of the week? Which one?
Re: First day of the week? Which one?
- Subject: Re: First day of the week? Which one?
- From: Deborah Goldsmith <email@hidden>
- Date: Fri, 28 Apr 2006 13:44:18 -0700
In any case, this discussion, while excitingly political, has no
real practicality. Follow iCal's example - have a pop-up menu with
every day of the week in it. Default to Monday if you like (I have
a feeling iCal does).
Please don't put up HI for this, unless you want the user to override
the default. You can get the information, based on the user's current
locale, from NSCalendar (available on 10.4 or later):
[[NSCalendar currentCalendar] firstWeekDay]
When it comes time to calculate stuff like this "week of the year"
thing, though, you're in trouble. There's several ways
acknowledged by the IEEE, plus the ISO way - which is more
complex. If you need to do that in your software, I don't envy
you. The theme seems to be, however, that the IEEE first week of
the year is the first week in the year starting with the first day
of the week - Monday, if you like. Or Sunday. Heck, use Octeday
if you really want. Whereas ISO favours the first week containing
four or more days in the new year. Good thing we don't have an
Octeday then, eh? :)
You can also get this from NSCalendar. It also varies by locale.
You'll need to set up a calendar and a date, then use [NSCalendar
components: fromDate:] to get the week of the year out.
The week of the year and day of the year can also be included in
formats using NSDateFormatter.
Deborah Goldsmith
Internationalization, Unicode liaison
Apple Computer, Inc.
email@hidden
On Apr 28, 2006, at 6:00 AM, Wade Tregaskis wrote:
But for that one example, there's plenty of others involving date
handling where it's probably irrelevant. Can you share your
particular scenario with us?
I guess there should perhaps be a setting for this in the Date &
Time preference pane.
In Germany and AFAIK most of Europe the week starts Monday. This
influences things like the week of the year (a concept heavily
used in businesses of here) and very visibly the way wall
calendars look like. If anybody starts her personal week on
Thursday that's fine, but I think Australia does have an official
definition for this. I know there is a ISO Standard for
calculating the week of the year...
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
http://en.wikipedia.org/wiki/Week
The "first week of the year" is defined by the ISO as the first
week in January to contain a Thursday; i.e. the first week with a
majority of days in the new year, if you take Monday as the first
day of the week, which they do. That's all good and dandy, but I'd
never heard of this in my life until you mentioned it. From
Wikipedia's article on the subject: "This style of numbering is
commonly used (for example, by businesses) in some European
countries, but rare elsewhere.
Not to be overly belittling, but I don't think it's up to some airy
fairy group to tell me or anyone else when they start their week.
Thus, it's good that the original poster is seeking ways to handle
this appropriately.
Also keep in mind that the ISO may not have authority in some
regions. I can't recall for sure the details in Australia, but I'm
pretty sure Australian engineers are expected to follow IEEE
standards, not ISO. The IEEE seems to favour Monday, but does
acknowledge the historical prevalence of Sunday, and seems to
encourage support for at least both.
http://www.opengroup.org/onlinepubs/000095399/utilities/date.html
Also note that it's the IEEE that provides the POSIX family of
standards, not the ISO. So anyone living and breathing *nix should
be looking to the IEEE, not ISO.
In any case, this discussion, while excitingly political, has no
real practicality. Follow iCal's example - have a pop-up menu with
every day of the week in it. Default to Monday if you like (I have
a feeling iCal does).
When it comes time to calculate stuff like this "week of the year"
thing, though, you're in trouble. There's several ways
acknowledged by the IEEE, plus the ISO way - which is more
complex. If you need to do that in your software, I don't envy
you. The theme seems to be, however, that the IEEE first week of
the year is the first week in the year starting with the first day
of the week - Monday, if you like. Or Sunday. Heck, use Octeday
if you really want. Whereas ISO favours the first week containing
four or more days in the new year. Good thing we don't have an
Octeday then, eh? :)
Lastly, brownie points to anyone who can explain how a group
calling themselves the "International Organization for
Standardization" - ironically using American spelling, not English
- can figure their acronym as "ISO"?
Wade Tregaskis
ICQ: 40056898
AIM, Yahoo & Skype: wadetregaskis
MSN: email@hidden
iChat & email: email@hidden
Jabber: email@hidden
Google Talk: email@hidden
http://homepage.mac.com/wadetregaskis/
-- Sed quis custodiet ipsos custodes?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden