[<<]Message[>>]    [<<]Author[>>]    [<<]Subject[>>]    [<<]Thread[>>]

Number : 4426 Date : 2003-04-24 Author : Kan Yabumoto Subject : Re: Date Macro Size(KB) : 4
Garry wrote: >Since Windows allows the setting of date formats using m/d/yy, >mm/dd/yy, yyyy-m-d, etc., etc., I don't see it as being unreasonable >to allow Xxcopy to support the same scheme other than to discourage >poor practice. It would seem logical to use the same letter >conventions as well. i.e. $yy.m.d$ means no leading zero for the day >and month, $yy-mm-dd$ means leading zeroes. The same logic would also >apply to $hh-nn-ss$. Windows has to do it every which way (consistent to their admirable work in the Arabic and Hebrew support). Besides my unfavorable opinion on the non-ISO format, I thought I had a more persuasive reason --- no reasonable designation (easy-to-remember and short) could be found easily. Well, I took a look at the keyword set once again. Then, I realized there is an elegant scheme that can be added. As a matter of fact, the idea was so neat to my eye, even if I disagree with all the non-ISO nonsense, I could not resist adding the support. The hint was already in my own message. Duh!!! And, Garry's comment trigger the flood. Here's the list of current macro keywords: Keyword comment ------------------------------------------------------ YYYY 4-digit year (good for 10000 years) YY 2-digit year (good for a century) Y 1-digit year (good for a decade) MM 2-digit month MON 3-letter month name DD 2-digit day HH 2-digit hour (0-23) NN 2-digit minute SS 2-digit second DATE same as MMDD TIME same as HHNN WWW 3-letter day of week name W 1-digit day of week (Sun:0 - Sat:6) ------------------------------------------------------ New addition ------------------------------------------------------ M 1 or 2 digits month (without leading 0) D 1 or 2 digits day (without leading 0) H 1 or 2 digits hour (without leading 0) N 1 or 2 digits min (without leading 0) S 1 or 2 digits sec (without leading 0) ------------------------------------------------------ I was already doing YY and Y as a special case of YYYY. Using the same logic, I could add M for month in one digit (and two for 10, 11 and 12). Similarly, D for a single-digit date (and two for 10 and above). The exactly the same scheme can be applied to H, N and S. Note: Now, having the non-leading-zero cases makes the single-digit-year notation look odd. In that case, Y will denote just the last digit of the Christian calendar year regardless of the full value (i.e., always a value 0 - 9). On the other hand, M, D, H, N, S will always expand to a full (either one or two digit) value. I can't stand the ugliness of the result but the scheme here is quite neat from programming point of view (that's enough to satisfy my ego as a programmer :-) OK, in the next release, you will see all the odd (variable-length) macros for M, D, H, N, S. Since the keyword matching is done from the longest matching pattern, we can unambiguously resolve the difference between D and DD and so on (See the example in XXTB #24 on how XXCOPY resolves a case like YYYYYYY). OK, as a result of all these changes, you can now say /$m-d-yy$ This is exactly what Doug was asking for. The beauty of this new feature is that the Europeans can say /$d.m.yy$ And the "ISO-conforming" Asians will have the ugly variation, /$yyyy-m-d$. The extra stuff that I added will accept /$h:n:s$ (Europeans are free to do /$s:n:h$ ) But, this is so ugly, I will not use it myself. XXCOPY now even allows you to be stupid /$mdyy$ this operation is unambiguous but the result may be ambiguous (11111 -- could be January 11th or November 1st). ------------------------------------------------------ OT: By the way, Garry, do the Aussies use European convention? http://dictionary.reference.com/search?q=aussie I was checking the spelling at Dictionary.Com, It says "Aussie" refers to native Australian (Aboriginal). I thought it was just a nickname for Australian. ----------------------------------------------------- I'm going to post the new version (betatest) v.2.84.1 in the very near future. Kan Yabumoto
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.