AbstractTime.st
changeset 11772 a220d63dfc64
parent 11771 1c6251b7286d
child 12002 3ecffb2d77ad
child 17711 39faaaf888b4
equal deleted inserted replaced
11771:1c6251b7286d 11772:a220d63dfc64
   846     self addPrintBindingsTo:aDictionary language:nil
   846     self addPrintBindingsTo:aDictionary language:nil
   847 !
   847 !
   848 
   848 
   849 addPrintBindingsTo:aDictionary language:languageOrNil
   849 addPrintBindingsTo:aDictionary language:languageOrNil
   850     "private print support: add bindings for printing to aDictionary.
   850     "private print support: add bindings for printing to aDictionary.
   851      languageOrNil can only be #en or nil for the current language."
   851      languageOrNil can only be #en or nil for the current language.
       
   852      bindings:
       
   853         %h      hours, 00..23 (i.e. european)  0-padded to length 2
       
   854         %u      hours, 00..12 (i.e. us)        0-padded to length 2
       
   855         %m      minutes, 00..59                0-padded to length 2
       
   856         %s      seconds, 00..59                0-padded to length 2
       
   857         %i      milliseconds, 000..999         0-padded to length 3
       
   858         %a      am/pm
       
   859 
       
   860      Timestamp only:
       
   861         %(day)   day, 00..31                    0-padded to length 2
       
   862         %(month) month, 00..12                  0-padded to length 2
       
   863         %(year)  year, 4 digits                 0-padded to length 4
       
   864 
       
   865      special:
       
   866         %H      24-hours - unpadded
       
   867         %U      12-hours - unpadded
       
   868         %M      minutes - unpadded
       
   869         %S      seconds - unpadded
       
   870         %I      milliseconds, unpadded
       
   871         %A      AM/PM   - uppercase
       
   872 
       
   873         %t      seconds within hour  (unpadded)
       
   874         %T      seconds from midNight  (unpadded)
       
   875 
       
   876         %(TZD)  timeZone delta from UTC in the format +/-hh:mm  
       
   877 
       
   878         %milli1 milliseconds, truncated to 1/10th of a second 0..9         
       
   879         %milli2 milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2        
       
   880 
       
   881         %nth           - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
       
   882         %weekDayNth    - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
       
   883         %weekNth       - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')      
       
   884 
       
   885      Timestamp only:
       
   886         %Day    day - unpadded                    
       
   887         %Month  month - unpadded                    
       
   888         %(yearOrTime)  year or time 5 digits    as in unix-ls:
       
   889                                                 year if it is not the current year;
       
   890                                                 time otherwise
       
   891 
       
   892 
       
   893      The ISO8601 printString are generated with:
       
   894 
       
   895        Year:
       
   896           YYYY (eg 1997)
       
   897                 Date today printStringFormat:'%(year)'
       
   898                 Timestamp now printStringFormat:'%(year)'  
       
   899 
       
   900        Year and month:
       
   901           YYYY-MM (eg 1997-07)
       
   902                 Date today printStringFormat:'%(year)-%(month)'  
       
   903                 Timestamp now printStringFormat:'%(year)-%(month)'  
       
   904 
       
   905        Complete date:
       
   906           YYYY-MM-DD (eg 1997-07-16)
       
   907                 Date today printStringFormat:'%(year)-%(month)-%(day)'    
       
   908                 Timestamp now printStringFormat:'%(year)-%(month)-%(day)'  
       
   909 
       
   910        Complete date plus hours and minutes:
       
   911           YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
       
   912                 Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)'  
       
   913 
       
   914        Complete date plus hours, minutes and seconds:
       
   915           YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
       
   916                 Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)'  
       
   917 
       
   918        Complete date plus hours, minutes, seconds and a decimal fraction of a second
       
   919           YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
       
   920                 Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)'  
       
   921 
       
   922     "
   852 
   923 
   853     |hours minutes seconds millis usHours ampm s zone tzDelta|
   924     |hours minutes seconds millis usHours ampm s zone tzDelta|
   854 
   925 
   855     hours := self hours.
   926     hours := self hours.
   856     minutes := self minutes.
   927     minutes := self minutes.
  1066 ! !
  1137 ! !
  1067 
  1138 
  1068 !AbstractTime class methodsFor:'documentation'!
  1139 !AbstractTime class methodsFor:'documentation'!
  1069 
  1140 
  1070 version
  1141 version
  1071     ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.63 2009-06-14 08:51:10 cg Exp $'
  1142     ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.64 2009-06-14 09:27:39 cg Exp $'
  1072 ! !
  1143 ! !