eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Date':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Date


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--Date

Package:
stx:libbasic
Category:
Magnitude-Time
Version:
rev: 1.196 date: 2018/05/25 10:17:59
user: cg
file: Date.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


Instances of Date represent dates as year, month and day encoded in the
(private & hidden) instance dateEncoding. The value found there is
year*100*100 + month*100 + day
This makes magnitude-like comparison of dates easy, and the main components
d,m,y are easily reconstructed (assuming, that this is the stuff most used).
Do not depend on the internal representation -
it is private and not guaranteed for future versions.

The old representation used days since 1st Jan. 1901 internally -
with the new implementation, it is possible to reasonably represent almost
any Date.
(which insurance companies will like,
 since they can now represent even very old people's birthday :-)

Notice:
    no correction for pre-Gregorian dates (< 1583) is done.
    For dates before 1582 (when calendars were changed from Julian to Gregorian),
    the so called 'proleptic gregorian calendar' is used.
    This assumes leap years to continue in the past as if a gregorian calendar was used.
    Thus, 0000 is considered a leap year.

The printed representation of dates is controlled by resource definitions -
thus national variants are already supported (see file 'resources/Date.rs').

Compatibility notice:
    due to historic reasons, there are some methods found twice
    with different names in this class. The old ST/X methods will vanish
    over time, but kept for a while to support existing applications
    (the info on how these methods should be named
     came somewhat late from the testers...).

    Please do not use methods marked as obsolete.

Most useful methods:

    Date today
    (Date today) addDays:
    (Date today) subtractDays:


Related information:

    Time
    AbstractTime
    Filename
    OperatingSystem

Class protocol:

Compatibility-Dolphin
o  newDay: day monthIndex: month year: year
Dolphin compatibility - same as newDay:month:year
usage example(s):
     Date newDay:8 monthIndex:5 year:1993

Compatibility-ST80
o  newDay: day monthNumber: monthIndex year: year
ST80 compatibility

Compatibility-Squeak
o  current
return the current date
usage example(s):
     Date current

o  fromSeconds: seconds
Answer an instance of me which is 'seconds' seconds after January 1, 1901.
usage example(s):
     Date fromSeconds:0
     Date fromSeconds:(24 * 60 * 60 * 365)

o  readMMDDYYYYFrom: aStringOrStream onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
Notice, that this is not the storeString format and
is different from the format expected by readFrom:
usage example(s):
     Date readMMDDYYYYFrom:'10041999' onError:['wrong date']  
     Date readMMDDYYYYFrom:'100419' onError:['wrong date']  

     Date readMMDDYYYYFrom:'10040001' onError:['wrong date']  

o  readYYYYMMDDFrom: aStringOrStream onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
Notice, that this is not the storeString format and
is different from the format expected by readFrom:
usage example(s):
     Date readYYYYMMDDFrom:'19991004' onError:['wrong date']  
     Date readYYYYMMDDFrom:'911004' onError:['wrong date']  

Javascript support
o  js_new: aString
( an extension from the stx:libjavascript package )
return a parsed dateobejct

o  now
( an extension from the stx:libjavascript package )
return the current date
usage example(s):
     JavaScriptParser
	evaluate:'Date.now.getDate;'

change & update
o  update: something with: aParameter from: changedObject
just remember change for next access

error handling
o  conversionErrorSignal
return the signal used for conversion error handling

general queries
o  abbreviatedDayNamesForLanguage: languageOrNilForDefault
return a collection of short month-names for a given language or the
current language if nil is given.
The returned strings depend on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, english names are returned
usage example(s):
     self abbreviatedDayNamesForLanguage:#en   
     self abbreviatedDayNamesForLanguage:#de   
     self abbreviatedDayNamesForLanguage:#fr   
     self abbreviatedDayNamesForLanguage:#es   
     self abbreviatedDayNamesForLanguage:#zulu 

     self abbreviatedDayNamesForLanguage:nil   

o  abbreviatedMonthNamesForLanguage: languageOrNilForDefault
return a collection of short month-names for a given language or the
current language if nil is given.
The returned strings depend on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, english names are returned
usage example(s):
     self abbreviatedMonthNamesForLanguage:#en
     self abbreviatedMonthNamesForLanguage:#de
     self abbreviatedMonthNamesForLanguage:#fr
     self abbreviatedMonthNamesForLanguage:#es
     self abbreviatedMonthNamesForLanguage:#zulu

     self abbreviatedMonthNamesForLanguage:nil

o  abbreviatedNameOfDay: dayIndex
given a day index (1..7),
return the abbreviated name of the day
for the current language setting
usage example(s):
     Date abbreviatedNameOfDay:4

o  abbreviatedNameOfDay: dayIndex language: langOrNilForDefault
given a day index (1..7),
return the abbreviated name of the day.
For nil, the current default language us used.
For unknown languages, english is used.
usage example(s):
     Date abbreviatedNameOfDay:4 language:#en    
     Date abbreviatedNameOfDay:4 language:#de    
     Date abbreviatedNameOfDay:4 language:#zulu  
     Date abbreviatedNameOfDay:4 language:nil    

o  abbreviatedNameOfMonth: monthIndex
given a month index (1..12),
return the abbreviated name of the month
for the current language setting
usage example(s):
     Date abbreviatedNameOfMonth:11
     Date abbreviatedNameOfMonth:12

o  abbreviatedNameOfMonth: monthIndex language: langOrNilForDefault
given a month index (1..12),
return the abbreviated name of the month.
For nil, the current default language us used.
For unknown languages, english is used.
usage example(s):
     Date abbreviatedNameOfMonth:11 language:#en     
     Date abbreviatedNameOfMonth:12 language:#en     
     Date abbreviatedNameOfMonth:12 language:#de     
     Date abbreviatedNameOfMonth:12 language:#fr     
     Date abbreviatedNameOfMonth:12 language:#zulu   
     Date abbreviatedNameOfMonth:12 language:nil     

o  dateAndTimeNow
return an array containing the date and time of now.
As these provide no timezone info, this should be only used for user interface purposes.
usage example(s):
     Date dateAndTimeNow

o  dayNamesForLanguage: languageOrNilForDefault
return a collection of day-names for a given language or the
current language if nil is given.
The returned strings depend on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, english names are returned
usage example(s):
     self dayNamesForLanguage:#en
     self dayNamesForLanguage:#de
     self dayNamesForLanguage:#fr   
     self dayNamesForLanguage:#es   

     self dayNamesForLanguage:#zulu 
     self dayNamesForLanguage:nil   

o  dayOfFirstWeekInYear: aYear
for a given year, return the day corresponding to that year's monday of week-01.
The 1st week is the one, in which the first thursday is found;
and the 1st day of that week is the preceeding monday
(that means: that the returned day might be a day of the previous year!)
usage example(s):
     Date newDay:1 year:1900  
     Date dayOfFirstWeekInYear:1900  
     Date dayOfFirstWeekInYear:1998   
     Date dayOfFirstWeekInYear:1999    
     Date dayOfFirstWeekInYear:2000  
     Date dayOfFirstWeekInYear:2001   

o  dayOfWeek: dayName
given the name of a day (either string or symbol),
return the day-index (1 for monday; 7 for sunday).
Return 0 for invalid day name
usage example(s):
     Date dayOfWeek:'wednesday' 
     Date dayOfWeek:'Wednesday' 
     Date dayOfWeek:'Mittwoch' 

o  dayOfWeek: dayName language: lang
given the name of a day (either string or symbol),
return the day-index (1 for monday; 7 for sunday).
Return 0 for invalid day name.
For nil, Smalltalk language is used,
for unknown languages, english is used.
usage example(s):
     Date dayOfWeek:'wednesday' language:'en'
     Date dayOfWeek:'Wednesday' language:'en'

o  daysInMonth: month forYear: yearInteger
given the name of a month and a year, return the number
of days this month has (modified GNU).
return 0 if the month name was invalid.
For your convenience, month maybe an integer or name-string.
usage example(s):
     Date daysInMonth:2 forYear:1980
     Date daysInMonth:2 forYear:1981
     Date daysInMonth:'feb' forYear:1981

o  daysInYear: yearInteger
return the number of days in a year
usage example(s):
     Date daysInYear:1900  
     Date daysInYear:1901 
     Date daysInYear:1904 
     Date daysInYear:1980 
     Date daysInYear:1981

o  daysUntilMonth: month forYear: yearInteger
given the name of a month and a year, return the number
of days from 1st january to last of prev month of that year.
Return 0 if the month name/index is invalid or is january.
For your convenience, month maybe an integer or name-string.
usage example(s):
     Date daysUntilMonth:'feb' forYear:1993
     Date daysUntilMonth:'jan' forYear:1993

o  defaultFormatString
a language specific format string to present dates in user interfaces.
Do not use this to store/retrieve dates (use ISO8601 for that)
usage example(s):
     Date today printStringFormat:(Date defaultFormatString).
     Date today printStringFormat:(Date longFormatString).
     Date today printStringFormat:(Date shortFormatString).

o  firstDayOfYear: inYear
return the weekDay-index of the 1st-january of the given year.
1->monday, 2->tuesday, ... 7->sunday
usage example(s):
     self firstDayOfYear:2000           
     (Date newDay:1 year:2000) dayInWeek 
     self firstDayOfYear:1999      
     (Date newDay:1 year:1999) dayInWeek
     self firstDayOfYear:1998      
     (Date newDay:1 year:1998) dayInWeek    
     self firstDayOfYear:2001           
     (Date newDay:1 year:2001) dayInWeek    
     self firstDayOfYear:2002           
     (Date newDay:1 year:2002) dayInWeek    
     self firstDayOfYear:2006           
     (Date newDay:1 year:2006) dayInWeek    

     self firstDayOfYear:1800           
     (Date newDay:1 year:1800) dayInWeek    

o  indexOfMonth: aMonthString
given the name of a month (either string or symbol),
return the month-index (1 for jan; 12 for december).
The given string may be a full or abbreviated name,
case is ignored.
Return 0 for invalid month name.
usage example(s):
     Date indexOfMonth:'jan'
     Date indexOfMonth:'Jan'  
     Date indexOfMonth:'December'
     Date indexOfMonth:'Dezember' 
     Date indexOfMonth:'december' 
     Date indexOfMonth:'dezember' 

o  indexOfMonth: aMonthString language: languageOrNil
given the name of a month (either string or symbol),
return the month-index (1 for jan; 12 for december).
The given string may be a full or abbreviated name,
case is ignored.
Return 0 for invalid month name.
For nil, Smalltalk language (i.e. the current language setting) is used,
for unknown languages, english is used.
usage example(s):
     Date indexOfMonth:'jan'      language:#en 
     Date indexOfMonth:'Jan'      language:#en 
     Date indexOfMonth:'December' language:#en 

o  leapYear: yearInteger
return true, if yearInteger is a leap year.
For years before 1583, the proleptic calendar is used
(i.e. assuming there was a gregorian calendar in effect)
usage example(s):
     Date leapYear:1992
     Date leapYear:1994
     Date leapYear:1900
     Date leapYear:2000

     Date leapYear:0
     Date leapYear:-1
     Date leapYear:-2
     Date leapYear:-3
     Date leapYear:-4

o  longFormatString
Date today printStringFormat:(Date defaultFormatString).
Date today printStringFormat:(Date longFormatString).
Date today printStringFormat:(Date shortFormatString).

o  monthAndDayFromDayInYear: aDayInYear forYear: yearInteger
given a day-in-year (1..365) return an Array containing the
month index and the day-in-month. Return nil if the argument is invalid.
usage example(s):
     Date monthAndDayFromDayInYear:66 forYear:1980
     Date monthAndDayFromDayInYear:66 forYear:1981

o  monthNamesForLanguage: languageOrNilForDefault
return a collection of month-names for a given language or the
current language if nil is given.
The returned strings depend on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, english names are returned
usage example(s):
     self monthNamesForLanguage:#en  
     self monthNamesForLanguage:#de  
     self monthNamesForLanguage:#fr   
     self monthNamesForLanguage:#es   

     self monthNamesForLanguage:#zulu 
     self monthNamesForLanguage:nil   

o  nameOfDay: dayIndex
given a day index (1..7), return the name of the day
usage example(s):
     Date nameOfDay:1
     Date nameOfDay:4

o  nameOfDay: dayIndex language: lang
given a day index (1..7), return the name of the day.
For nil, Smalltalk language is used,
for unknown languages, english is used.
usage example(s):
     Date nameOfDay:4 language:#en

o  nameOfMonth: monthIndex
given a month index (1..12), return the name of the month
usage example(s):
     Date nameOfMonth:11
     Date nameOfMonth:12
     Date nameOfMonth:4

o  nameOfMonth: monthIndex language: lang
given a month index (1..12), return the name of the month.
For nil, Smalltalk language is used,
for unknown languages, english is used.
usage example(s):
     Date nameOfMonth:11 language:#en
     Date nameOfMonth:12 language:#en
     Date nameOfMonth:4  language:#en

o  shortFormatString
Date today printStringFormat:(Date defaultFormatString).
Date today printStringFormat:(Date longFormatString).
Date today printStringFormat:(Date shortFormatString).

o  weekInYearOf: aDateOrTimestamp
for a given date or timeStamp, return the week-number.
The returned week number starts with 1 for the first week which has a thursday in it.
(see DIN 1355-1/ISO 8601)
The rule is:
every monday (and only monday), a new week begins
the first week is the one which has at least 4 days of the new year in it

Be prepared: this definition can lead to the 1st week starting in the old year!

o  yearAsDays: yearInteger
Returns the number of days since Jan 1, 1901. (GNU)
to the first Jan of the year, yearInteger.
For 1901 this is zero, for 1902 it's 365.
Defined for years >= 1901
usage example(s):
     Date yearAsDays:5 
     Date yearAsDays:1900 
     Date yearAsDays:1901 
     Date yearAsDays:1902   
     Date yearAsDays:1903   
     Date yearAsDays:1904    
     Date yearAsDays:1905     
     Date yearAsDays:1994   
     (Date yearAsDays:2001) - (Date yearAsDays:2000)   

o  yearAsDaysFrom0: yearInteger
Returns the number of days since Jan 1, 0 to Jan 1, yearInteger
without caring for gregorian calendar change
(i.e. as if there was a gregorian for all time).
Also assuming that the leapYear rules were present in pre-gregorian times also.
Used internally to compute date differences.

In previous versions, dates were counted relative to 1.1.1901.
This is no longer done; however, for backward compatibility, the old yearAsDays
and Date fromDays is still supported.

For years >= 1901 it must hold that:
yearAsDaysFrom0(d1) - yearAsDaysFrom0(d2)
is the same as
yearAsDays(d1) - yearAsDays(d2)

usage example(s):
     Date yearAsDaysFrom0:1900 
     Date yearAsDaysFrom0:1901 
     Date yearAsDaysFrom0:1902   
     Date yearAsDaysFrom0:1903   
     Date yearAsDaysFrom0:1904    
     Date yearAsDaysFrom0:1905     
     Date yearAsDaysFrom0:1994 

     (Date yearAsDays:2001) - (Date yearAsDays:2000)   
     (Date yearAsDaysFrom0:2001) - (Date yearAsDaysFrom0:2000)   

     (Date yearAsDays:2002) - (Date yearAsDays:2001)           
     (Date yearAsDaysFrom0:2002) - (Date yearAsDaysFrom0:2001)   

     Date yearAsDaysFrom0:-4     -1461  -- -4 was a leap year
     Date yearAsDaysFrom0:-3     -1095
     Date yearAsDaysFrom0:-2     -730
     Date yearAsDaysFrom0:-1     -365
     Date yearAsDaysFrom0:0      0
     Date yearAsDaysFrom0:1      366     -- 0 was a leap year
     Date yearAsDaysFrom0:2      731
     Date yearAsDaysFrom0:3      1096
     Date yearAsDaysFrom0:4      1461
     Date yearAsDaysFrom0:5      1827    -- 0 and 4 are leap years

initialization
o  initDefaultNames
read the language specific names.
usage example(s):
     Date initDefaultNames

o  initNames
read the language specific names.
usage example(s):
     Date initNames

o  initNamesForLanguage: language
read the language specific names.
usage example(s):
     Date initNamesForLanguage:#de.
     Date initNamesForLanguage:#fr.
     Date initNamesForLanguage:#es.

o  initialize

instance creation
o  fromDays: dayCount
return a new Date, given the day-number starting with 0 at 1.Jan 1901;
(i.e. 'Date fromDays:0' returns 1st Jan. 1901).
Date asDays is the reverse operation.
Notice, that this is not able to represent dates before 1901!.
Added for GNU/ST-80 compatibility
usage example(s):
     Date fromDays:0     -> 1 jan 1901
     Date fromDays:365   -> 1 jan 1902
     Date fromDays:730   -> 1 jan 1903
     Date fromDays:1095  -> 1 jan 1904
     Date fromDays:1460  ->31 dec 1904 since 1904 was a leap year

o  fromDaysFrom0: dayCount
return a new Date, given the day-number starting with 0 at 1.Jan 0;
(i.e. 'Date fromDaysSince0:0' returns 1st Jan. 0).
Date asDaysSince0 is the reverse operation.
Notice, that this is a private interface.
Also notice: does not care for Gregorian/Julisn calendar change
usage example(s):
     Date fromDaysFrom0:0     -> 1 jan 0
     Date fromDaysFrom0:366   -> 1 jan 1

o  newDay: dayInYear year: year
return a new Date, given the year and the day-in-year (starting at 1).
See also: Date today / Time now / Timestamp now.
ST-80 compatibility
usage example(s):
     Date newDay:150 year:1994
     Date newDay:1 year:1994
     Date newDay:1 year:1901
     Date newDay:1 year:1902
     Date newDay:365 year:1992
     Date newDay:366 year:1992
     Date newDay:365 year:1994
     Date newDay:366 year:1994
     Date newDay:0 year:1994

     Date newDay:271 year:2008
     Date newDay:270 year:2008
     Date newDay:271 year:2007

o  newDayInWeek: dayInWeek week: week year: yearArg
return a new Date, given the year, the week (1..) and the day in week (1..7).
See http://en.wikipedia.org/wiki/ISO_week_date
usage example(s):
     Date newDayInWeek:6 week:39 year:2008     
     Date newDayInWeek:1 week:40 year:2014     
     Date newDayInWeek:1 week:44 year:2014     

o  readFrom: aStringOrStream format: aSqueakFormatArrayOrFormatString
return a new Date, reading a printed representation from aStream.
aSqueakFormatArrayOrFormatString may either be a squeak formatArray
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or a formatString (see printing instance protocol).

o  readFrom: aStringOrStream format: aFormatStringOrSqueakFormatArray language: languageOrNil onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
aFormatStringOrSqueakFormatArray may either be a Squeak formatArray:
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or an ST/X formatString (see printing instance protocol).
For now %d, %m, %monthName, %shortMonthName, %y, %Y, %y1900, %y2000, %y1950 and %y1980 are supported in the formatString.
y1900 converts 2-digit year YY into 19YY,
y2000 into 20YY.
y1950, y1980, y1970 and Y are special;
if the year is below 50/80/70/70, it is converted to 20YY, otherwise to 19YY.
The formatString can have any of these characters '-.:,;/' as separator.
The format may be preceeded by a single numeric length (as in %2d) to specify how many
characters to read.
The formatString can also use a space as separator (for ex. '%d %m %y') and any separator will be allowed.
However, when a character separator is defined, only that separator will be expected.
TODO: make this a general feature of all DateAndTime classes.

usage example(s):
     Date readFrom:'31 December 1992' printFormat:#(1 2 3) onError:'fail' 
     Date readFrom:'19:11:1999' printFormat:#(1 2 3) onError:'fail'  
     Date readFrom:'December, 5 1992' printFormat:#(1 2 3) onError:'fail' 
     Date readFrom:'3-jan-95' printFormat:#(1 2 3) onError:'fail'          
     Date readFrom:'12/31/1992' printFormat:#(1 2 3) onError:'fail'       
     Date readFrom:'15.4.1992' printFormat:#(1 2 3) onError:'wrong date'  -> german
     Date readFrom:'10.4.1992' printFormat:#(1 2 3) onError:'fail'        -> german
     Date readFrom:'10.4.1992' printFormat:#(1 2 3) onError:['wrong date']
     Date readFrom:'32.4.1992' printFormat:#(1 2 3) onError:['wrong date']
     Date readFrom:'fooBar' printFormat:#(1 2 3) onError:['wrong date']
     Date readFrom:'10.4' printFormat:#(1 2 3) onError:['wrong date']
     Date readFrom:'10041999' printFormat:#(1 2 3) onError:['wrong date']  

     Date readFrom:'31/12/92' printFormat:#(1 2 3) onError:'fail'       
     Date readFrom:'31/12/01' printFormat:#(1 2 3) onError:'fail'       

     Date readFrom:'31/12/01' printFormat:'%d %m %y' onError:'fail'       
     Date readFrom:'12/01' printFormat:'%m %y' onError:'fail'       
     Date readFrom:'01' printFormat:'%y' onError:'fail'       
     Date readFrom:'30.01' printFormat:'%d %m' onError:'fail'     
     Date readFrom:'300180' printFormat:'%2d%2m%2y' onError:'fail' 
     
     Date readFrom:'300170' printFormat:'%2d%2m%2y' onError:'fail'      - gives 2070 as year
     Date readFrom:'300170' printFormat:'%2d%2m%2Y' onError:'fail'      - gives 1970 as year
     Date readFrom:'300169' printFormat:'%2d%2m%2y' onError:'fail'      - gives 2069 as year
     Date readFrom:'300169' printFormat:'%2d%2m%2Y' onError:'fail'      - gives 2069 as year

     Date readFrom:'300170' printFormat:'%2d%2m%2(y1950)' onError:'fail'  - gives 1970 as year   
     Date readFrom:'300170' printFormat:'%2d%2m%2(y1980)' onError:'fail'  - gives 2070 as year   
     Date readFrom:'300181' printFormat:'%2d%2m%2(y1980)' onError:'fail'  - gives 1981 as year   

     Date readFrom:'2015103' printFormat:'%4y%3(dayOfYear)' onError:'fail'   

     Date readFrom:'3-3-1995' printFormat:'%d %m %y' language: #de onError:'fail'          
     Date readFrom:'3-März-1995' printFormat:'%d %monthName %y' language: #de onError:'fail'          
     Date readFrom:'3-mär-1995' printFormat:'%d %shortMonthName %y' language: #de onError:'fail'   
     Date readFrom:'3/mär/1995' printFormat:'%d %shortMonthName %y' language: #de onError:'fail'  
     Date readFrom:'3/mär/1995' printFormat:'%d-%shortMonthName-%y' language: #de onError:'fail'          
     Date readFrom:'3-dez-1995' printFormat:'%d %shortMonthName %y' language: #de onError:'fail'          
     Date readFrom:'3-Dez-1995' printFormat:'%d %shortMonthName %y' language: #de onError:'fail'          
     Date readFrom:'3-Dezember-1995' printFormat:'%d %monthName %y' language: #de onError:'fail'          

o  readFrom: aStringOrStream format: aSqueakFormatArrayOrFormatString onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
aSqueakFormatArrayOrFormatString may either be a Squeak formatArray:
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or an ST/X formatString (see printing instance protocol).
All of the %-formats as in the printString are supported here.
(i.e. %d, %m and %y, %shortMonthName and %monthName)
In addition, %Y, %y1900, %y2000, %y1950 and %y1980 are supported:
y1900 converts 2-digit year YY into 19YY, y2000 into 20YY.
y1950, y1980 and Y are special; if the year is below 50/80/70, it is converted to 20YY, otherwise to 19YY.
TODO: make this a general feature of all DateAndTime classes.

usage example(s):
     Date readFrom:'31 December 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'19:11:1999' format:#(1 2 3) onError:'fail'  
     Date readFrom:'December, 5 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'3-jan-95' format:#(1 2 3) onError:'fail'          
     Date readFrom:'12/31/1992' format:#(1 2 3) onError:'fail'       
     Date readFrom:'15.4.1992' format:#(1 2 3) onError:'wrong date'  -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:'fail'        -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'32.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'fooBar' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10.4' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10041999' format:#(1 2 3) onError:['wrong date']  

     Date readFrom:'31/12/92' format:#(1 2 3) onError:'fail'       
     Date readFrom:'31/12/01' format:#(1 2 3) onError:'fail'       

     Date readFrom:'31/12/01' format:'%d %m %y' onError:'fail'       
     Date readFrom:'12/01' format:'%m %y' onError:'fail'       
     Date readFrom:'01' format:'%y' onError:'fail'       
     Date readFrom:'30.01' format:'%d %m' onError:'fail'       
     Date readFrom:'311201' format:'%2d%2m%2y' onError:'fail'       

o  readFrom: aStringOrStream onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
Notice, that this is not the storeString format and
is different from the format expected by readFrom:.

BUG:
For Smalltalk compatibility, this method handles american format (i.e. month/day/year),
the common format with letter month in the middle (10 December 2007)
and ISO format (yyyy-mm-dd) - as long as yyyy is > 12.

It does NOT handle the german/french and other dd-mm-yyyy formats.
use readFrom:printFormat:onError: for this.
usage example(s):
     Date readFromString:'31 December 1992'  
     Date readFrom:'19:11:1999'  
     Date readFrom:'2007-12-31' onError:'wrong date'.  
     Date readFromString:'December, 5 1992'  
     Date readFromString:'12/31/1992'        
     Date readFromString:'3-jan-95'           
     Date readFromString:'3-jan-01'           
     Date readFromString:'12/31/01'        
     Date readFromString:'15.4.1992'         -> german; leads to an error
     Date readFromString:'10.4.1992'         -> german; leads to a wrong date
     Date readFromString:'10.4.1992' onError:['wrong date']
     Date readFromString:'32.4.1992' onError:['wrong date']
     Date readFromString:'fooBar' onError:['wrong date']
     Date readFromString:'10.4' onError:['wrong date']
     Date readFromString:'10041999' onError:['wrong date']  

o  today
return a date, representing today.
See also: Time now / Timestamp now.
usage example(s):
     Date today

o  tomorrow
return a date, representing tomorrow.
See also: Time now / Timestamp now.
usage example(s):
     Date tomorrow 
     Date tomorrow dayInWeek

o  utcToday
return a date, representing today in UTC.
That is, the current date in London without any daylight saving adjustments.
See also: Time now / Timestamp now.
usage example(s):
     Date today
     Date utcToday

o  year: year month: month day: day
return a new Date, given the day, month and year.
For your convenience, month may be either an integer
or the month's name as a string.

WARNING: semantics changed: 0..99 is no longer treated as 1900..1999,
but as 0..99 now.
Any such adjustments must be made by the caller of this method now
(see those, for example readFrom:onError:)
usage example(s):
     Date year:1993  month:'may' day:8
     Date year:1993  month:5     day:8
     Date year:2004 month:'feb' day:29
     Date year:2003 month:'feb' day:29
     Date year:5 month:'feb' day:28   
     Date year:95 month:'feb' day:28  

o  yesterday
return a date, representing yesterday.
See also: Time now / Timestamp now.
usage example(s):
     Date yesterday 
     Date yesterday dayInWeek

misc ui support
o  iconInBrowserSymbol
( an extension from the stx:libtool package )
the browser will use this as index into the toolbariconlibrary

obsolete
o  day: day month: month year: year
return a new Date, given the day, month and year.
Obsolete:
use newDay:month:year: for ST-80 compatibility

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  day: dayInYear year: year
return a new Date, given the year and the day-in-year (starting at 1).
Obsolete:
use newDay:year: for ST-80 compatibility

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  isLeapYear: yearInteger
Return true, if a year is a leap year.
Obsolete:
Please use the ST-80 compatible #leapYear for new programs,
since this method will vanish.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  newDay: day month: month year: year
backward compatibility

o  readFrom: aStringOrStream printFormat: aSqueakFormatArrayOrFormatString
OBSOLETE: kept for backward compatibility.
return a new Date, reading a printed representation from aStream.
aSqueakFormatArrayOrFormatString may either be a squeak formatArray
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or a formatString (see printing instance protocol).

o  readFrom: aStringOrStream printFormat: aFormatStringOrSqueakFormatArray language: languageOrNil onError: exceptionBlock
OBSOLETE: kept for backward compatibility
return a new Date, reading a printed representation from aStream.
aFormatStringOrSqueakFormatArray may either be a Squeak formatArray
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or an ST/X formatString (see printing instance protocol).
For now %d, %m, %monthName, %shortMonthName, %y, %y1900, %y2000, %y1950 and %y1980 are supported in the formatString.
y1900 converts 2-digit year YY into 19YY, y2000 into 20YY.
y1950 and y1980 are special; if the year is below 50/80, it is converted to 20YY, otherwise to 19YY.
The formatString can have any of these characters '-.:,;/' as separator.
The format may be preceeded by a single numeric length (as in %2d) to specify how many
characters to read.
The formatString can also use a space as separator (for ex. '%d %m %y') and any separator will be allowed.
However, when a character separator is defined, only that separator will be expected.
TODO: make this a general feature of all DateAndTime classes.

usage example(s):
     Date readFrom:'31 December 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'19:11:1999' format:#(1 2 3) onError:'fail'  
     Date readFrom:'December, 5 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'3-jan-95' format:#(1 2 3) onError:'fail'          
     Date readFrom:'12/31/1992' format:#(1 2 3) onError:'fail'       
     Date readFrom:'15.4.1992' format:#(1 2 3) onError:'wrong date'  -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:'fail'        -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'32.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'fooBar' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10.4' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10041999' format:#(1 2 3) onError:['wrong date']  

     Date readFrom:'31/12/92' format:#(1 2 3) onError:'fail'       
     Date readFrom:'31/12/01' format:#(1 2 3) onError:'fail'       

     Date readFrom:'31/12/01' format:'%d %m %y' onError:'fail'       
     Date readFrom:'12/01' format:'%m %y' onError:'fail'       
     Date readFrom:'01' format:'%y' onError:'fail'       
     Date readFrom:'30.01' format:'%d %m' onError:'fail'     
     Date readFrom:'300180' format:'%2d%2m%2y' onError:'fail' 
     
     Date readFrom:'300170' format:'%2d%2m%2y' onError:'fail'      - gives 2070 as year
     Date readFrom:'300170' format:'%2d%2m%2(y1950)' onError:'fail'  - gives 1970 as year   
     Date readFrom:'300170' format:'%2d%2m%2(y1980)' onError:'fail'  - gives 2070 as year   
     Date readFrom:'300181' format:'%2d%2m%2(y1980)' onError:'fail'  - gives 1981 as year   

     Date readFrom:'3-3-1995' format:'%d %m %y' language: #de onError:'fail'          
     Date readFrom:'3-März-1995' format:'%d %monthName %y' language: #de onError:'fail'          
     Date readFrom:'3-mär-1995' format:'%d %shortMonthName %y' language: #de onError:'fail'   
     Date readFrom:'3/mär/1995' format:'%d %shortMonthName %y' language: #de onError:'fail'  
     Date readFrom:'3/mär/1995' format:'%d-%shortMonthName-%y' language: #de onError:'fail'          
     Date readFrom:'3-dez-1995' format:'%d %shortMonthName %y' language: #de onError:'fail'          
     Date readFrom:'3-Dez-1995' format:'%d %shortMonthName %y' language: #de onError:'fail'          
     Date readFrom:'3-Dezember-1995' format:'%d %monthName %y' language: #de onError:'fail'          

o  readFrom: aStringOrStream printFormat: aSqueakFormatArrayOrFormatString onError: exceptionBlock
return a new Date, reading a printed representation from aStream.
aSqueakFormatArrayOrFormatString may either be a Squeak formatArray
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
or an ST/X formatString (see printing instance protocol).
All of the %-formats as in the printString are supported here.
(i.e. %d, %m and %y, %shortMonthName and %monthName)
In addition, %y1900, %y2000, %y1950 and %y1980 are supported:
y1900 converts 2-digit year YY into 19YY, y2000 into 20YY.
y1950 and y1980 are special; if the year is below 50/80, it is converted to 20YY, otherwise to 19YY.
TODO: make this a general feature of all DateAndTime classes.

usage example(s):
     Date readFrom:'31 December 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'19:11:1999' format:#(1 2 3) onError:'fail'  
     Date readFrom:'December, 5 1992' format:#(1 2 3) onError:'fail' 
     Date readFrom:'3-jan-95' format:#(1 2 3) onError:'fail'          
     Date readFrom:'12/31/1992' format:#(1 2 3) onError:'fail'       
     Date readFrom:'15.4.1992' format:#(1 2 3) onError:'wrong date'  -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:'fail'        -> german
     Date readFrom:'10.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'32.4.1992' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'fooBar' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10.4' format:#(1 2 3) onError:['wrong date']
     Date readFrom:'10041999' format:#(1 2 3) onError:['wrong date']  

     Date readFrom:'31/12/92' format:#(1 2 3) onError:'fail'       
     Date readFrom:'31/12/01' format:#(1 2 3) onError:'fail'       

     Date readFrom:'31/12/01' format:'%d %m %y' onError:'fail'       
     Date readFrom:'12/01' format:'%m %y' onError:'fail'       
     Date readFrom:'01' format:'%y' onError:'fail'       
     Date readFrom:'30.01' format:'%d %m' onError:'fail'       
     Date readFrom:'311201' format:'%2d%2m%2y' onError:'fail'       

private
o  dayAbbrevsForLanguage: languageOrNilForDefault
return a collection of short day-names for a given language or the
current language if nil is given.
The returned strings depend on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, english names are returned

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  daysInMonthIndex: monthIndex forYear: yearInteger
return the number of days in month monthIndex of
year yearInteger (modified GNU).
Return 0 for invalid month index.
This is the internal version of daysInMonth:forYear:
usage example(s):
     Date daysInMonthIndex:2 forYear:1994
     Date daysInMonthIndex:2 forYear:1980
     Date daysInMonthIndex:2 forYear:1981

o  daysUntilMonthIndex: monthIndex forYear: yearInteger
return the number of days from 1st January up to month monthIndex of
year yearInteger (modified GNU).
Return 0 for invalid month index.
This is the internal version of dayInMonth:forYear:
usage example(s):
     Date daysUntilMonthIndex:3 forYear:1994
     Date daysUntilMonthIndex:3 forYear:1980
     Date daysUntilMonthIndex:3 forYear:1981

private-encoding/decoding
o  encodeYear: y month: m day: d
the internal encoding is strictly private,
and should not be used outside.

o  readDatePartFrom: str format: fmt language: languageOrNil
read a single component (such as %shortName) from str

private-instance creation
o  fromOSTime: osTime
return a date, representing the date given by the operatingSystem time.
This somewhat clumsy implementation hides the OS's date representation
(i.e. makes this class independent of what the OS starts its time values with).
Don't use this method, the osTime representation is totally unportable.
usage example(s):
     Date fromOSTime:0              -> on UNIX: this should return 1st Jan 1970
                                       that's where Unix time starts
                                       On other systems, it may be something different.

     Date fromOSTime:(24*60*60*1000) -> on UNIX: the day after


Instance protocol:

Compatibility-ANSI
o  dayOfWeek
return the week-day of the receiver - 1 is sunday, 7 for saturday.
WARNING: different from dayInWeek (which returns 1 for monday, ... 7 for sunday).

usage example(s):
     Date today dayOfWeek
     Date today dayInWeek

o  dayOfWeekAbbreviation
return the short week-day of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'mon', 'tue' ...
usage example(s):
     Date today dayOfWeekAbbreviation

o  dayOfWeekName
return the week-day of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'monday', 'tuesday' ...
usage example(s):
     Date today dayOfWeekName
     Date today dayOfWeekAbbreviation 

o  dayOfYear
return the day-nr within the year of the receiver - 1..365/366
usage example(s):
     Date today dayOfYear 

o  monthAbbreviation
return the month of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'jan', 'feb' ...
usage example(s):
     Date today monthAbbreviation  

Compatibility-ST80
o  firstDayInMonth
Return the first day in the month of the receiver
usage example(s):
     Date today               
     Date today firstDayInMonth    
     Date today firstDayInMonth subtractDays:1   
     (Date today subtractDays:30) firstDayInMonth   
     (Date today subtractDays:122) firstDayInMonth   
     (Date today subtractDays:154) firstDayInMonth

o  lastDayInMonth
Return the last day in the month in which the receiver is.
usage example(s):
     Date today       
     Date today lastDayInMonth        
     Date today lastDayInMonth addDays:1  

o  next: dayName
Return the next date whose weekday name is dayName.
Caveat; dayName is expected to be in the current language
usage example(s):
     Date today              
     Date today next:#Friday
     Date today next:#Sunday 
     Date today next:#Monday 
     Date today next:#Thursday
     Date today next:#WednesDay

o  nextDayWithIndex: dayIndex
Return the next date whose weekday name is dayName.
dayIndex is Monday=1, ... , Sunday=7
usage example(s):
     Date today              
     Date today nextDayWithIndex:5 - next Friday
     Date today nextDayWithIndex:7  
     Date today nextDayWithIndex:1  
     Date today nextDayWithIndex:4  
     Date today nextDayWithIndex:3  

o  previous: dayName
Return the previous date whose weekday name is dayName.
Caveat; dayName is expected to be in the current language
usage example(s):
     Date today                    
     Date today previous:#Montag 
     Date today previous:#Monday 

     Date today previous:#Friday  
     Date today previous:#Sunday  
     Date today previous:#Monday  
     Date today previous:#Thursday  
     Date today previous:#WednesDay 
     Date today previous:#TuesDay  

o  previousDayWithIndex: dayIndex
Return the previous date whose weekday name is dayIndex.
dayIndex is Monday=1, ... , Sunday=7
usage example(s):
     Date today                    
     Date today previousDayWithIndex:1 
     Date today previousDayWithIndex:5  
     Date today previousDayWithIndex:7  
     Date today previousDayWithIndex:4  
     Date today previousDayWithIndex:3 
     Date today previousDayWithIndex:2  

o  printFormat: aFormatArray
Obsolete, backward ST-80 compatible formatted printing - see printStringFormat:
Return a string containing a printed representation of the receiver.
The formatArray argument consists of 6 or 7 integers which control
the resulting string. The entries are:
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
4 asciiValue of separator character or separator character
or collection of 2 separator characters
5 month format (1: numeric; 2: abbreviated name; 3: fullname
4: abbreviated uppercase 5: full uppercase)
6 year format (1 include century; 2 exclude century)
7 (optional) true/false.
if true, print numbers in 2-digit format
(i.e. with leading zeros);
Taken as false, if omited

Day and monthnames are in the currently active language.

This method supports more options than the ST-80 version; month formats
4 and 5, non-numeric separators and the optional 7th parameter are not
supported by ST-80. Be aware of this for compatibility reasons.

Notice that not all formats can be scanned (correctly) by #readFrom:
This is an ST-80 compatibility method - I would have choosen another
(less cryptic) formatString ...

usage example(s):
     Date today printFormat:#(1 2 3 '' 1 2)          
     Date today printFormat:#(1 2 3 $- 1 2)          
     Date today printFormat:#(1 2 3 $. 1 2 true)     
     Date today printFormat:#(2 1 3 32 3 1)          
     Date today printFormat:#(2 1 3 #(' ' ', ') 3 1)  
     Date today printFormat:#(1 2 3 $- 2 1)          
     Date today printFormat:#(1 2 3 $- 4 1)          

o  printFormat: aFormatArray forLanguage: languageOrNil
Obsolete, backward ST-80 compatible formatted printing - see printStringFormat:
Return a string containing a printed representation of the receiver.
The formatArray argument consists of 6 or 7 integers which control
the resulting string. The entries are:
1 day position (1, 2 or 3)
2 month position (1..3)
3 year position (1..3)
4 asciiValue of separator character or separator character
or collection of 2 separator characters
5 month format (1: numeric; 2: abbreviated name; 3: fullname
4: abbreviated uppercase 5: full uppercase)
6 year format (1 include century; 2 exclude century)
7 (optional) true/false.
if true, print numbers in 2-digit format
(i.e. with leading zeros);
Taken as false, if omited

Day and monthnames are in the currently active language.

This method supports more options than the ST-80 version; month formats
4 and 5, non-numeric separators and the optional 7th parameter are not
supported by ST-80. Be aware of this for compatibility reasons.

Notice that not all formats can be scanned (correctly) by #readFrom:
This is an ST-80 compatibility method - I would have choosen another
(less cryptic) formatString ...

usage example(s):
     Date today printFormat:#(1 2 3 '' 1 2)
     Date today printFormat:#(1 2 3 $- 1 2)
     Date today printFormat:#(1 2 3 $. 1 2 true)
     Date today printFormat:#(2 1 3 32 3 1)
     Date today printFormat:#(2 1 3 #(' ' ', ') 3 1)
     Date today printFormat:#(1 2 3 $- 2 1) forLanguage:#en
     Date today printFormat:#(1 2 3 $- 4 1) forLanguage:#en

o  printFormat: aFormatArray forLanguage: languageOrNil on: aStream
Obsolete, backward ST-80 compatible formatted printing - see comment
in printFormat:.
Append a printed representation of the receiver to aStream.
The argument, aFormatString controls the format, as described
in the #printFormat: method.
Notice that not all formats can be scanned (correctly) by #readFrom:
usage example(s):
european formats:

     Date today printFormat:#(1 2 3 $- 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 3 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $. 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $. 1 2 true) on:Transcript. Transcript cr.

     US formats:

     Date today printFormat:#(2 1 3 32 3 1) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 32 2 2) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 $/ 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 #(' ' ', ') 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 4 1) on:Transcript. Transcript cr.

o  printFormat: aFormatArray on: aStream
Obsolete, backward ST-80 compatible formatted printing - see comment
in printFormat:.
Append a printed representation of the receiver to aStream.
The argument, aFormatString controls the format, as described
in the #printFormat: method.
Notice that not all formats can be scanned (correctly) by #readFrom:
usage example(s):
european formats:

     Date today printFormat:#(1 2 3 $- 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 3 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $. 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $. 1 2 true) on:Transcript. Transcript cr.

     US formats:

     Date today printFormat:#(2 1 3 32 3 1) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 32 2 2) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 $/ 1 2) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(2 1 3 #(' ' ', ') 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr.
     Date today printFormat:#(1 2 3 $- 4 1) on:Transcript. Transcript cr.

o  shortPrintString
dummy - for now

o  weekdayIndex
Return the day index; Monday=1, ... , Sunday=7
usage example(s):
     Date today dayName
     Date today weekdayIndex      

Compatibility-Squeak
o  mmddyyyy
return a printed representation of the receiver in the
form mmddyyyy.
The receiver can be reconstructed with:
Date readMMDDYYYYFrom:aStringOrStream onError:[...]
usage example(s):
     Date today mmddyyyy

accessing
o  abbreviatedDayName
return the short week-day-name of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'mon', 'tue' ...
usage example(s):
     Date today abbreviatedDayName
     (Date newDay:15 month:4 year:1959) abbreviatedDayName

o  abbreviatedDayNameForLanguage: lang
return the short week-day-name of the receiver as a string.
The returned string depends on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, the english name is returned.
Expect things like 'mon', 'tue' ...
usage example(s):
     Date today abbreviatedDayNameForLanguage:#en      
     Date today abbreviatedDayNameForLanguage:#de      
     Date today abbreviatedDayNameForLanguage:#zulu 

     (Date newDay:15 month:4 year:1959) abbreviatedDayName

o  abbreviatedMonthName
return the short month name of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'jan', 'feb' ...
usage example(s):
     Date today abbreviatedMonthName
     (Date newDay:15 month:4 year:1959) abbreviatedMonthName

o  abbreviatedMonthNameForLanguage: lang
return the short month-name of the receiver as a string in a given language.
The returned string depends on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, the english name is returned.
Expect things like 'jan', 'feb' ...
usage example(s):
     Date today abbreviatedMonthNameForLanguage:#en 
     Date today abbreviatedMonthNameForLanguage:#de 
     Date today abbreviatedMonthNameForLanguage:#zulu 

o  asDays
return the number of days elapsed since 01-Jan-1901
and the receiver's day; starts with 0 for 1-1-1901.
Date>>fromDays: is the reverse operation.
Notice,
that this represents dates before 1901 as negative values!
For GNU/ST-80 compatibility.
usage example(s):
     (Date newDay: 5 month: 8 year: 1962) asDays  -> should be 22496
     (Date newDay: 1 month: 1 year: 1901) asDays  -> 0
     (Date newDay: 31 month: 12 year: 1900) asDays -> -1
     (Date newDay: 1 month: 1 year: 1800) asDays  -> -36889
     Date today asDays    
     Date fromDays:(Date today asDays + 7) 

o  asDaysFrom0
return the number of days elapsed since 01-Jan-0
and the receiver's day; starts with 0 for 1-1-0.
Date>>fromDaysFrom0: is the reverse operation.
Notice, that this is not able to represent dates before 0!.
usage example(s):
     (Date newDay: 1 month: 1 year: 0) asDaysFrom0  -> should be 0
     (Date newDay: 1 month: 1 year: 1) asDaysFrom0  -> should be 366
     Date fromDaysFrom0:(Date today asDaysFrom0 + 7) 

o  asSeconds
return the seconds between 1.jan.1901 and the same time in the receiver's
day. (i.e. midnight to midnight). The returned number may be negative for dates before 1901.
This does not include any leapSeconds ... strictly speaking, this is incorrect.
ST-80 compatibility.
usage example(s):
     (Date newDay: 5 month: 8 year: 1962) asSeconds
     (Date newDay: 1 month: 1 year: 1901) asSeconds
     (Date newDay: 1 month: 1 year: 1700) asSeconds
     (Date today addDays:7) asSeconds - Date today asSeconds

o  day
return the day (1..31) of the receiver

o  dayInWeek
return the week-day of the receiver - 1 for monday, 7 for sunday.
WARNING: different from (american) dayOfWeek (which returns 1 for sunday, ... 7 for saturday).
WARNING: does not care for pre-gregorian dates
(i.e. do not use this for dates before 1583)

usage example(s):
     Date today dayInWeek    
     Date tomorrow dayInWeek
     Date yesterday dayInWeek 
     (Date today subtractDays:2) dayInWeek   
     Date today weekday                      
     Date tomorrow weekday                   
     Date yesterday weekday                  
     (Date newDay:15 month:4 year:1959) dayInWeek 
     (Date newDay:1 month:1 year:1901) dayInWeek   
     (Date newDay:31 month:12 year:1900) dayInWeek 
     (Date newDay:31 month:12 year:1899) dayInWeek 

     Date today dayInWeek    
     Date today dayOfWeek    

o  dayInYear
return the day-nr within the year of the receiver - 1 .. 365/366
usage example(s):
     Date today dayInYear 
     (Date newDay:1 year:1999) dayInYear
     (Date newDay:1 year:2000) dayInYear
     (Date newDay:2 year:2000) dayInYear
     (Date newDay:59 year:2004) dayInYear
     (Date newDay:60 year:2004) dayInYear
     (Date newDay:61 year:2004) dayInYear
     (Date newDay:366 year:2004) dayInYear
     (Date newDay:59 year:2005) dayInYear
     (Date newDay:60 year:2005) dayInYear
     (Date newDay:365 year:2005) dayInYear

o  dayOfMonth
Answer the day of the month represented by me.
Same as day; for ST-80 compatibility.
usage example(s):
     Date today dayOfMonth

o  daysInMonth
return the number of days in the month of the receiver
usage example(s):
     Date today daysInMonth

o  daysInYear
return the number of days in the year of the receiver
usage example(s):
     Date today daysInYear

o  daysLeftInMonth
return the number of days left in the month of the receiver
usage example(s):
     Date today daysLeftInMonth             

o  daysLeftInYear
return the number of days left in the year of the receiver.
Today is excluded from the count (i.e. in a non-leap-year,
the first january will return 364)
usage example(s):
     Date today daysLeftInYear             

o  isLeapYear
return true, if the receiver's year is a leap year
usage example(s):
     Date today isLeapYear
     (Date newDay:1 month:1 year:1992) isLeapYear

o  month
return the month (1..12) of the receiver
usage example(s):
     Date today month

o  monthIndex
return the index of the month (e.g. Feb.=2).
Same as month; for ST-80 compatibility.

o  monthName
return the month of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'january', 'february' ...
usage example(s):
     Date today monthName
     (Date newDay:15 month:4 year:1959) monthName

o  monthNameForLanguage: languageOrNil
return the month-name of the receiver as a string in a given language.
The returned string depends on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, the english name is returned.
Expect things like 'january', 'february' ...
usage example(s):
     Date today monthName                 

     Date today monthNameForLanguage:#en  
     Date today monthNameForLanguage:#de  
     Date today monthNameForLanguage:#zulu

o  weekInYear
return the week number of the receiver - 1 for Jan, 1st.
each week is Mon .. Sun (i.e. Sunday belongs to the previous week)
usage example(s):
     Date today weekInYear    
     (Date newDay:1 year:2000) weekInYear   was a saturday
     (Date newDay:2 year:2000) weekInYear   was a sunday
     (Date newDay:3 year:2000) weekInYear   was a monday
     (Date newDay:4 year:2000) weekInYear   was a tuesday
     (Date newDay:5 year:2000) weekInYear   was a wed
     (Date newDay:6 year:2000) weekInYear   was a thursday
     (Date newDay:7 year:2000) weekInYear   was a fri
     (Date newDay:8 year:2000) weekInYear   was a sat
     (Date newDay:9 year:2000) weekInYear   was a sun
     (Date newDay:10 year:2000) weekInYear  was a monday
     (Date newDay:3 month:1 year:2001) weekInYear 

o  weekday
return the week-day of the receiver as a string.
The returned string depends on the current language setting.
Expect things like 'monday', 'tuesday' ...
For ST-80 compatibility
usage example(s):
     Date today weekday
     (Date newDay:15 month:4 year:1959) weekday

o  weekdayForLanguage: lang
return the week-day-name of the receiver as a string in a given language.
The returned string depends on the resource translation file to be present for the
given language (i.e. libbasic/resources(<lang>.rs).
If not, the english name is returned.
Expect things like 'monday', 'tuesday'...
usage example(s):
     Date today weekdayForLanguage:#de      -> Mittwoch
     Date today weekdayForLanguage:#en      -> wednesday
     Date today weekdayForLanguage:#zulu    -> wednesday       

     (Date newDay:15 month:4 year:1959) weekdayForLanguage:#de  
     (Date newDay:15 month:4 year:1959) weekdayForLanguage:#en  
     (Date newDay:15 month:4 year:1959) weekdayForLanguage:#zulu

o  year
return the year of the receiver
usage example(s):
     Date today year
     Date today subtractDays:(1000 * 365)
     Date today addDays:(1000 * 365)

o  year: year month: month day: day

arithmetic
o  + days
return a new date representing 'days' after the receiver.
The argument should be some kind of integer.
This is the same as #addDays.
usage example(s):
     Date today + 7.

     Date today to:(Date today + 28) by:7 do:[:date|
        Transcript show:date weekday; show:', '; showCr:date
     ].

o  - aDateOrNumberOfDays
return the delta in days (anInteger) between 2 dates or
subtract a number of days from a date returning a Date
usage example(s):
     Date today - Date yesterday  
     Date today - 3               
     Date today + 3               

o  addDays: days
return a new date representing 'days' after the receiver.
The argument should be some kind of integer.
For ST-80 compatibility.
usage example(s):
     Date today addDays:7

o  addMonths: numberOfMonths
Return a new instance which added numberOfMonths to self months.
Keep the day of month if possible.
If the month of the new instance has fewer days than self dayOfMonth set the day to the last
day of the new instance's month.
Does (probably) not work correct for resulting dates before calendar reform.

o  addMonthsUsingEncoding: numberOfMonths
Return a new instance which added numberOfMonths to self months.
Keep the day of month if possible.
If the month of the new instance has fewer days than self dayOfMonth,
set the day to the last day of the new instance's month.
Does (probably) not work correct for resulting dates before calendar reform.

o  addYears: numberOfYears
Return a new instance which is the same date, but numberOfYears ahead of self.
Cares about leap years.
I.e. goes from a leap year's 29.feb to a non-leap year's 28.feb.

o  daysSince: aDate
return the number of days between the receiver and the argument,
aDate, which should be some kind of date
usage example(s):
     Date today daysSince:(Date newDay:1 month:1 year:1901) 

o  daysUntil: aDate
return the number of days between the receiver and the argument,
aDate, which should be some kind of date
usage example(s):
     (Date newDay:24 month:12 year:1994) daysUntil:(Date day:1 month:1 year:1995)
     (Date newDay:1 month:2 year:1992) daysUntil:(Date day:1 month:3 year:1992)
     (Date newDay:1 month:2 year:1994) daysUntil:(Date day:1 month:3 year:1994)
    
     |delta|
     delta := Date today
                daysUntil:(Date newDay:25 month:12 year:Date today year).
     Transcript show:'still ';
                show:delta ;
                showCR:' days till xmas'

o  firstDayInPreviousMonth: nMonths
Return the first day of a previous month (0=this month, 1=prev. month, etc.).
CG: there are two such methods - which one is obsolete?
usage example(s):
     (Date newDay:3 month:6 year:2009) firstDayInMonth     
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:0    
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:5    
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:6    
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:7    
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:17    
     (Date newDay:3 month:6 year:2009) firstDayInPreviousMonth:18    

o  firstDayOfPreviousMonth: nMonths
Return the first day of a previous month (0=this month).
CG: there are two such methods - which one is obsolete? (see firstDayInPreviousMonth:)
usage example(s):
     (Date newDay:3 month:6 year:2009) firstDayInMonth     
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:0  
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:5    
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:6    
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:7    
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:17    
     (Date newDay:3 month:6 year:2009) firstDayOfPreviousMonth:18  

o  subtractDate: aDate
return the number of days between the receiver and aDate
usage example(s):
    (Date newDay:1 month:1 year:1995) subtractDate:(Date newDay:24 month:12 year:1994)
    (Date newDay:1 month:3 year:1992) subtractDate:(Date newDay:1 month:2 year:1992)
    (Date newDay:1 month:3 year:1994) subtractDate:(Date newDay:1 month:2 year:1994)

o  subtractDays: days
return a new date representing 'days' before the receiver.
The argument should be some kind of integer.
For ST-80 compatibility
usage example(s):
     Date today subtractDays:7

comparing
o  < aDate
return true, if the date represented by the receiver
is before the argument, aDate
usage example(s):
        Date today < (Date day:24 month:12 year:2000)
        Date today < (Date day:24 month:12 year:1900)
        Date today < Timestamp now
        Date today-1 < Timestamp now

o  = aDate
return true, if the date represented by the receiver
is the same as the one represented by argument, aDate
usage example(s):
    ^ dateEncoding = (Date encodeYear:aDate year
                                month:aDate month
                                  day:aDate day)
usage example(s):
Date today = ((Date today plusDays:7) minusDays:7)

o  > aDate
return true, if the date represented by the receiver
is after the argument, aDate
usage example(s):
      Date today > (Date newDay:24 month:12 year:2099)
      Date today > (Date newDay:24 month:12 year:1900)
      Date today > Timestamp now
      Date today+1 > Timestamp now

o  hash
return an integer useful for hashing on dates

converting
o  asDate
return the receiver

o  asLocalTimestamp
return an TimeStamp instance, representing midnight of last night
usage example(s):
     Date today asLocalTimestamp

o  asTimeStamp
( an extension from the stx:goodies/webServer/comanche package )
Answer the receiver as a TimeStamp at midnight.

o  asTimestamp
return an TimeStamp instance, representing midnight of last night
usage example(s):
     Date today asTimestamp

o  asUtcTimestamp
return an UtcTimestamp instance, representing midnight of last night
usage example(s):
     Date today asUtcTimestamp

inspecting
o  inspectorExtraAttributes
( an extension from the stx:libtool package )
extra (pseudo instvar) entries to be shown in an inspector.

obsolete
o  asAbsoluteTime
deprecated, use #asTimestamp

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  dayCount
return the number of days since 1st. Jan. 1901;
starting with 0 for this date.
Date>>fromDays: is the reverse operation.
Obsolete:
please use asDays for ST-80 compatibility

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  dayName
return the week-day of the receiver as a string.
The returned string depends on the language setting.
Expect things like 'monday', 'tuesday' ...
Obsolete:
use #weekday for ST-80 compatibility

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  leap
return true, if the receiver's year is a leap year

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  minusDays: days
return a new date representing 'days' before the receiver.
The argument should be some kind of integer.
Obsolete:
Please don't use this method since it will vanish.
Use #subtractDays: instead for ST-80 compatibility.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  plusDays: days
return a new date representing 'days' after the receiver.
The argument should be some kind of integer.
Obsolete:
Please don't use this method since it will vanish.
Use #addDays: instead for ST-80 compatibility.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

printing & storing
o  addPrintBindingsTo: aDictionary
see comment in addPrintBindingsTo:language:

o  addPrintBindingsTo: aDictionary language: languageOrNil
private print support: add bindings for printing to aDictionary.
languageOrNil can only be #en or nil for the current language setting (Smalltalk language).

valid format items are:
%d - day, 01..31 0-padded to length 2
%m - month, 01..12 0-padded to length 2
%w - week in year, 00..53 0-padded to length 2
%y - year, full i.e. '1999', '2004'

special:
%D - day - unpadded
%M - month - unpadded
%W - week in year - unpadded
%Y - year, last 2 digits only i.e. 1999->'99', 1904->'04', 2004->'04'
(danger: year 2k bug)
makes any date a 2-digit value.
Only use to process/generate old (backward compatible) datasets
which were generated way before y2k, and the old (bad) values need to
be regenerated.

%Y1900 - year, last 2 digits of 19YY i.e. 1999->'99', 1904->'04', 2004->error
(danger: year 2k bug)
raises an error, if the year is not in 1900..1999
Only use to process/generate old (backward compatible) datasets
which were generated way before y2k, and the old (bad) values need to
be regenerated. Same as above, but with error reporting

%Y2000 - year, last 2 digits of 20YY only i.e. 2001->'01', 2004->'04' 2099->'99'
raises an error, if the year is not in 2000..2099

%Y1950 - year, last 2 digits of 19YY or 20YY only i.e. 2001->'01', 2049->'49', 1950->'50', 1999->'99'
raises an error, if the year is not in 1950..2049.
this is occasionally used to get old (pre y2k) data converted.

%Y1980 - year, last 2 digits of 19YY or 20YY only i.e. 2001->'01', 2079->'79, 1999->'99'
same as above, with boundary year at 1980
raises an error, if the year is not in 1980..2079
this is occasionally used to get old (pre y2k) data converted.

%Y1970 - same as above, with boundary year at 1970.
raises an error, if the year is not in 1970..2069

%(weekDay) - day in week (1->monday, 2->tuesday, ... ,7->sunday)
%(dayOfYear) - day in year (1..365/366)

%(dayName) - full day name
%(DayName) - full day name, first character uppercase
%(DAYNAME) - full day name, all uppercase

%(monthName) - full month name
%(MonthName) - full month name, first character uppercase
%(MONTHNAME) - full month name, all uppercase

%(shortDayName) - short (abbreviated) day name
%(ShortDayName) - short (abbreviated) day name, first character uppercase
%(SHORTDAYNAME) - short (abbreviated) day name, all uppercase

%(shortMonthName) - short (abbreviated) month name
%(ShortMonthName) - short (abbreviated) month name, first character uppercase
%(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')

%(yearRoman) - year, in roman letters
%(monthRoman) - month, in roman letters

o  inspectorValueStringInListFor: anInspector
( an extension from the stx:libtool package )
returns a string to be shown in the inspector's list

o  printIso8601CompressedOn: aStream
append the compact iso8601 representation of the receiver to aStream.
This format looks like:
19990101T240000
or, for zero hr:min:sec,
19990101
Of course, a 24 hour clock is used.

No timezone information is added, so the reader will read as local time.

o  printIso8601FormatOn: aStream
append the iso8601 representation of the receiver to aStream.
This format looks like:
1999-01-01T24:00:00
or, for zero hr:min:sec,
1999-01-01
Of course, a 24 hour clock is used.

No timezone information is added, so the reader will read as local time.
usage example(s):
     Timestamp now printStringIso8601Format -> '2018-05-09T12:17:32.646+02'.
     Date today printStringIso8601Format -> '2018-05-09'.
     Time now printStringIso8601Format -> '2018-05-09'.

     Timestamp now printIso8601FormatOn:Transcript. Transcript cr.
     Timestamp readIso8601FormatFrom:(Timestamp now printStringIso8601Format).

     UtcTimestamp now printIso8601FormatOn:Transcript. Transcript cr.
     UtcTimestamp readIso8601FormatFrom:(UtcTimestamp now printStringIso8601Format).

o  printOn: aStream
append a printed representation of the receiver to aStream
usage example(s):
     Date today printOn:Transcript. Transcript cr.

o  printOn: aStream format: aFormatStringOrSqueakFormatArray
print using a format string;
see #addPrintBindingsTo: for a list of valid format strings
usage example(s):
     Date today printOn:Transcript format:'%y%m%d'                                      (iso format)
     Date today printOn:Transcript format:'%y-%m-%d'                                    (iso format)
     Date today printOn:Transcript format:'%y-W%w'                                      (iso format - working week)
     Date today printOn:Transcript format:'%d-%m-%y'                                    (european trivia format)
     Date today printOn:Transcript format:'%m/%d/%y'                                    (us trivia format)
     Date today printOn:Transcript format:'%D-%(monthName)-%y'                          (us trivia format)
     Date today printOn:Transcript format:'%D-%(MonthName)-%y'                          (us trivia format)
     Date today printOn:Transcript format:'%D-%(MONTHNAME)-%y'                          (us trivia format)
     Date today printOn:Transcript format:'%(DayName), %D%(nth) of %(MonthName), %y'   
     Date today printOn:Transcript format:'%(ShortDayName), %D-%(ShortMonthName)-%y'   
     Date today printOn:Transcript format:'%d%m%Y'                                      (millenium bug format - danger)
     Date today printOn:Transcript format:'%d%m%(Y1950)'                                (millenium bug partial workaround format - danger)
     Date today printOn:Transcript format:'%d%m%(Y1980)'                                (millenium bug partial workaround format - danger)
     Date today printOn:Transcript format:'Today is the %(weekDay) day of the week'     
     Date today printOn:Transcript format:'Today is %(year).%(monthRoman).%D'           (hungarian format)
     Date today printOn:Transcript format:'Today is %(D) %(monthRoman) %y'              (poland)
     Date today printOn:Transcript format:'Today is %(D)-%(monthRoman)-%y'              (romania)
     Date today printOn:Transcript format:'Today is %(D)/%(mon)-%Y'                     (sweden)
     Date today printOn:Transcript format:'Anno domini %(yearRoman)'
     Date today printOn:Transcript format:'%y年%(mon)月%d日'                               (select a font, which can display those chars)
     Date today printOn:Transcript format:'%(dayOfYear)'                                      
usage example(s):
short form (as in blogs like www.stackoverflow, www.superuser etc.)
     Date today printOn:Transcript format:'%(MonthName) %D ''%Y'     
     Timestamp now printOn:Transcript format:'%(MonthName) %D ''%Y at %h:%m'     
usage example(s):
Squeak format spec:
     String streamContents:[:s |
        Date today printOn:s format:#(1 2 3 $/ 1 2)
     ]    

o  printOn: aStream format: aFormatStringOrSqueakFormatArray language: languageOrNil
print using a format string;
languageOrNil can only be #en or nil for the current language.
see #addPrintBindingsTo: for a list of valid format strings
usage example(s):
     Date today 
        printOn:Transcript 
        format:'%y%m%d'                             
        language:#en                             

o  printOn: aStream language: languageOrNil
append a printed representation of the receiver to aStream.
The argument languageOrNil can only be #en or nil for the current language.
usage example(s):
     Date today printOn:Transcript language:#en
     Date today printOn:Transcript language:#de

o  printStringFormat: aFormatStringOrArray
print using a format string;
see #addPrintBindingsTo: for a list of valid format strings
usage example(s):
     Date today printStringFormat:'%y%m%d'                                      (iso format)
     Date today printStringFormat:'%y-%m-%d'                                    (iso format)
     Date today printStringFormat:'%y-W%w'                                      (iso format - working week)
     Date today printStringFormat:'%d-%m-%y'                                    (european trivia format)
     Date today printStringFormat:'%m/%d/%y'                                    (us trivia format)
     Date today printStringFormat:'%D-%(monthName)-%y'                          (us trivia format)
     Date today printStringFormat:'%D-%(MonthName)-%y'                          (us trivia format)
     Date today printStringFormat:'%D-%(MONTHNAME)-%y'                          (us trivia format)
     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 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'           

o  printStringFormat: aFormatStringOrArray language: languageOrNil
print using a format string;
languageOrNil can only be #en or nil for the current language.
see #addPrintBindingsTo: for a list of valid format strings
usage example(s):
     Date today printStringFormat:'%y%m%d'                                      (iso format)
     Date today printStringFormat:'%y-%m-%d'                                    (iso format)
     Date today printStringFormat:'%y-W%w'                                      (iso format - working week)
     Date today printStringFormat:'%d-%m-%y'                                    (european trivia format)
     Date today printStringFormat:'%m/%d/%y'                                    (us trivia format)
     Date today printStringFormat:'%D-%(monthName)-%y'                          (us trivia format)
     Date today printStringFormat:'%D-%(MonthName)-%y'                          (us trivia format)
     Date today printStringFormat:'%D-%(MONTHNAME)-%y'                          (us trivia format)
     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 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'           

o  printStringIso8601
return the Iso8601 representation of the receiver with local timezon information.
This format looks like:
1999-01-01T24:00:00
or, for zero hr:min:sec,
1999-01-01
Of course, a 24 hour clock is used.
usage example(s):
     Date today printStringIso8601
     Timestamp now printStringIso8601
     Time now printStringIso8601

o  printStringIso8601Compressed
return the Iso8601 representation of the receiver with local timezon information.
This format looks like:
19990101T240000
or, for zero hr:min:sec (i.e. Date),
19990101
Of course, a 24 hour clock is used.
usage example(s):
     Date today printStringIso8601
     Date today printStringIso8601Compressed
     Timestamp now printStringIso8601
     Timestamp now printStringIso8601Compressed
     Time now printStringIso8601
     Time now printStringIso8601Compressed

o  storeOn: aStream
append a representation to aStream, from which the receiver
can be reconstructed
usage example(s):
     Date today storeOn:Transcript
     Date today storeString

o  yyyymmdd
( an extension from the stx:goodies/webServer/comanche package )
no delimiters
usage example(s):
Date today yyyymmdd

private-accessing
o  dateEncoding
the internal encoding is stricktly private,
and should not be used outside.

o  dateEncoding: anInteger
the internal encoding is stricktly private,
and should not be used outside.

o  fromOSTime: osTime
set my dateEncoding as date in the local timezone from an OS time.
This somewhat clumsy implementation hides the OS's date representation
(i.e. makes this class independent of what the OS starts its time values with).
Don't use this method, the osTime representation is totally unportable.

o  fromUtcOSTime: osTime
set my dateEncoding as UTC date from an OS time.
This somewhat clumsy implementation hides the OS's date representation
(i.e. makes this class independent of what the OS starts its time values with).
Don't use this method, the osTime representation is totally unportable.

o  getMilliseconds
protocol compatibility with Timestamp.
Only use to get millisecond deltas between dates (if at all).
Returns the number of milliseconds of midnight since the epoch (1.1.1970).
Notice:
because Date does not include timezone info (in contrast to Timestamp),
this returns the millis of the UTC date (see example below).
Notice:
beacuse of that, always use Timestamps for comparisons.
usage example(s):
     Date today asUtcTimestamp getMilliseconds
        -
     Date today getMilliseconds

     Date today asTimestamp getMilliseconds
        -
     Date today getMilliseconds

     (Date year:1970 month:1 day:1) asTimestamp getMilliseconds     -- local time
     (Date year:1970 month:1 day:1) asUtcTimestamp getMilliseconds  -- utc time
     (Date year:1970 month:1 day:1) getMilliseconds                 -- utc time

visiting
o  acceptVisitor: aVisitor with: aParameter
dispatch for visitor pattern; send #visitDate:with: to aVisitor



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 06:57:35 GMT