![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 4441 Date : 2003-04-25 Author : Garry Deane Subject : Re: Date Macro Size(KB) : 2
--- In xxcopy@yahoogroups.com, Kan Yabumoto wrote: > That's interesting. I could do that. I would use /$KK$ > rather than /$WW$ (see below for why). Also, for the > convenience of adding the prefix, W to easily conform to the > ISO 8601 standard, we can define /$WKK$ specifically for that. > So, /$KK$ will expand to a value like 17 and /$WKK$ expands > to W17. > > Therefore, Garry's "clumsy" notation will be cleaned up; > > /$yyyy-wkk-k$ (See below for the single /$K$) I may not have thought this through enough because I forgot that when you are calculating ISO week, it is not complete without also giving the year because the year may not be the same as the calendar year e.g. 2002-12-31=2003-W01-2, 2000-01-01=1999-W52-6. It could get very messy if someone specifed say /$yyyy-wkk-k$ for the source and /$yyyy- mm-dd$ for the destination. Xxcopy has to determine the year according to the context. > I was not aware that the ISO standard assigns the radix > value of 7 for Sunday. That seems contrary to my sense > of tradition that most people consider Sunday as the > beginning of the week. Look at Window's Date and Time > display. The calendar clearly shows Sunday to the left > which is the most common calendar I've seen. > Apparently, ISO treats a week as starting on Monday and > ending on Sunday. > > The ISO web page does not tell it explicitly. > > http://www.iso.ch/iso/en/prods-services/popstds/datesandtime.html > > But, from its context, it is reasonable to interpret that > ISO defines that a week starts on Monday. Yes, that is correct e.g. the following from http://wwwcdf.pd.infn.it/MLO/Calendars/Notes.html#isoweek. "ISO-8601 defines the week as starting with Monday and ending with Sunday; and the first week of a year as the first week which is mostly within the Gregorian year. That last definition is equivalent to the following two variants: the week which contains the first Thursday of the Gregorian year; and the week containing January 4th." > Well, figuring the week-of-the-year value will be > a bit of a pain to program. But, it should not be > too bad (XXCOPY already knows how to convert a date > to the day-of-the-week and also knows the leap-year > rules). Actually the algorithm is relatively straightforward and can be deduced from the above definition. I've seen code and pseudo code on several web sites and have even written NT batch code to do this in about a dozen lines (excluding wrapper code and comments). Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.