printFormat
authorClaus Gittinger <cg@exept.de>
Tue, 03 Jun 2003 12:36:51 +0200
changeset 7327 ab17eb5f11a6
parent 7326 ce7d54205527
child 7328 2180d3e4da7e
printFormat
AbsoluteTime.st
AbstractTime.st
Date.st
Timestamp.st
--- a/AbsoluteTime.st	Mon Jun 02 12:00:02 2003 +0200
+++ b/AbsoluteTime.st	Tue Jun 03 12:36:51 2003 +0200
@@ -616,7 +616,10 @@
 !
 
 dayInWeek
-    "return the week-day of the receiver - 1 for monday, 7 for sunday"
+    "return the week-day of the receiver - 1 for monday, 7 for sunday
+     WARNING: different from ANSIs dayOfWeek (which returns 1 for sunday, ... 7 for saturday).  
+     WARNING: does not care for pre-julian dates 
+        (i.e. do not use this for dates before 1752)"
 
     ^ (OperatingSystem computeTimeAndDateFrom:osTime) at:11
 
@@ -1170,5 +1173,5 @@
 !AbsoluteTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.76 2003-03-09 15:32:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.77 2003-06-03 10:36:42 cg Exp $'
 ! !
--- a/AbstractTime.st	Mon Jun 02 12:00:02 2003 +0200
+++ b/AbstractTime.st	Tue Jun 03 12:36:51 2003 +0200
@@ -803,6 +803,10 @@
         %t      seconds within hour  (unpadded)
         %T      seconds from midNight  (unpadded)
 
+        %nth           - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekDayNth    - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekNth       - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+
      AbsoluteTime only:
         %Day    day - unpadded                    
         %Mon    month - unpadded                    
@@ -854,6 +858,10 @@
         %milli1 milliseconds, truncated to 1/10th of a second 0..9         
         %milli2 milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2        
 
+        %nth           - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekDayNth    - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekNth       - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+
      AbsoluteTime only:
         %Day    day - unpadded                    
         %Month  month - unpadded                    
@@ -973,5 +981,5 @@
 !AbstractTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.42 2003-05-19 08:24:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.43 2003-06-03 10:36:51 cg Exp $'
 ! !
--- a/Date.st	Mon Jun 02 12:00:02 2003 +0200
+++ b/Date.st	Tue Jun 03 12:36:51 2003 +0200
@@ -1705,7 +1705,6 @@
     "
 ! !
 
-
 !Date methodsFor:'printing & storing'!
 
 addPrintBindingsTo:aDictionary
@@ -1777,8 +1776,12 @@
     aDictionary at:#ShortMonthName put:mn asUppercaseFirst.
     aDictionary at:#SHORTMONTHNAME put:mn asUppercase.
 
-    aDictionary at:#nth put:(#('th' 'st' 'nd' 'rd' 'th' 'th' 'th' 'th' 'th' 'th') at:d \\ 10 + 1).
-                              "/ 0   1    2    3    4    5    6    7    8    9
+    aDictionary at:#nth        put:(#('th' 'st' 'nd' 'rd' 'th' 'th' 'th' 'th' 'th' 'th') at:d \\ 10 + 1).
+                                     "/ 0   1    2    3    4    5    6    7    8    9
+    aDictionary at:#weekDayNth put:(#('th' 'st' 'nd' 'rd' 'th' 'th' 'th') at:dw-1 \\ 10 + 1).
+                                     "/ 0   1    2    3    4    5    6      
+    aDictionary at:#weekNth    put:(#('th' 'st' 'nd' 'rd' 'th' 'th' 'th' 'th' 'th' 'th') at:w \\ 10 + 1).
+                                     "/ 0   1    2    3    4    5    6    7    8    9     
 !
 
 printOn:aStream
@@ -1827,6 +1830,8 @@
         %SHORTMONTHNAME - short (abbreviated) month name, all uppercase       
 
         %nth           - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekDayNth    - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekNth       - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
 
      for ST80/squeak compatibility (which expects a format-array), the following is also supported:
         #(item item item sep monthfmt yearfmt twoDigits)
@@ -1899,6 +1904,8 @@
         %SHORTMONTHNAME - short (abbreviated) month name, all uppercase       
 
         %nth           - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekDayNth    - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
+        %weekNth       - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
     "
 
     |dict|
@@ -1920,7 +1927,9 @@
      Date today printStringFormat:'%(DayName), %D%(nth) of %(MonthName), %y'   
      Date today printStringFormat:'%(ShortDayName), %D-%(ShortMonthName)-%y'   
      Date today printStringFormat:'%d%m%Y'                                      (millenium bug format - danger)
-     Date today printStringFormat:'Today is the %(weekDay) day of the week'     
+     Date today printStringFormat:'Today is day %(weekDay) of the week'              
+     Date today printStringFormat:'Today is the %(weekDay)%(weekDayNth) day of the week'     
+     Date today printStringFormat:'Today is the %(Day)%(nth) day of the month'           
     "
 !
 
@@ -1984,7 +1993,7 @@
 !Date class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.72 2003-05-19 10:54:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.73 2003-06-03 10:36:32 cg Exp $'
 ! !
 
 Date initialize!
--- a/Timestamp.st	Mon Jun 02 12:00:02 2003 +0200
+++ b/Timestamp.st	Tue Jun 03 12:36:51 2003 +0200
@@ -616,7 +616,10 @@
 !
 
 dayInWeek
-    "return the week-day of the receiver - 1 for monday, 7 for sunday"
+    "return the week-day of the receiver - 1 for monday, 7 for sunday
+     WARNING: different from ANSIs dayOfWeek (which returns 1 for sunday, ... 7 for saturday).  
+     WARNING: does not care for pre-julian dates 
+        (i.e. do not use this for dates before 1752)"
 
     ^ (OperatingSystem computeTimeAndDateFrom:osTime) at:11
 
@@ -1170,5 +1173,5 @@
 !AbsoluteTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.76 2003-03-09 15:32:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.77 2003-06-03 10:36:42 cg Exp $'
 ! !