eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Date':

Home

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

Class: Date


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--AbstractChronologyObject
         |
         +--Date

Package:
stx:libbasic
Category:
Kernel-Chronology
Version:
rev: 1.231 date: 2024/03/19 16:50:22
user: stefan
file: Date.st directory: libbasic
module: stx stc-classLibrary: libbasic

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:

copyright

COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

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/VW 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']  
     Date readMMDDYYYYFrom:'10-04-2001' onError:['wrong date']  

o  readYYMMDDFrom: 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 readYYMMDDFrom:'991004' onError:['wrong date']  
     Date readYYMMDDFrom:'211004' onError:['wrong date']  
     Date readYYMMDDFrom:'21-10-04' onError:['wrong date']  

o  readYYMMFrom: 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 readYYMMFrom:'9910' onError:['wrong date']  
     Date readYYMMFrom:'2010' onError:['wrong date']  
     Date readYYMMFrom:'20-10' 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:'1999-10-04' onError:['wrong date']  
     Date readYYYYMMDDFrom:'911004' onError:['wrong date']  

o  readYYYYMMFrom: 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 readYYYYMMFrom:'199910' onError:['wrong date']  
     Date readYYYYMMFrom:'1999-10' onError:['wrong date']  
     Date readYYYYMMFrom:'9110' onError:['wrong date']  

o  year: year day: dayInYear
return a new Date, given the year and the day-in-year (starting at 1).
See also: Date today / Time now / Timestamp now.
Squeak compatibility

Usage example(s):

     self year:1970 day:1
     self year:2000 day:1

Javascript support
o  js_new
( an extension from the stx:libjavascript package )
return the current timestamp

o  js_new: aStringOrNumber
( an extension from the stx:libjavascript package )
return a timestamp; from either the string representation or the millis since
the epoch.
This is a synthetic selector, generated by the JS compiler,
if a construct of the form new Date(arg) is parsed.
I.e.
new Date(x)
generates
Date js_new:x

o  js_new: year new: month
( an extension from the stx:libjavascript package )
return a timestamp.
this is a synthetic selector, generated by the JS compiler,
if a construct of the form new Date(dim1, dim2) is parsed.
I.e.
new Date(y,m)
generates
Date js_new:y new:m

o  js_new: year new: month new: day
( an extension from the stx:libjavascript package )
return a timestamp.
this is a synthetic selector, generated by the JS compiler,
if a construct of the form new Date(y,m,d) is parsed.
I.e.
new Date(y,m,d)
generates
Date js_new:y new:m new:d

o  js_new: year new: month new: day new: hour
( an extension from the stx:libjavascript package )
return a timestamp.

o  js_new: year new: month new: day new: hour new: minute
( an extension from the stx:libjavascript package )
return a timestamp.

o  js_new: year new: month new: day new: hour new: minute new: second
( an extension from the stx:libjavascript package )
return a timestamp.

o  js_new: year new: month new: day new: hour new: minute new: second new: millis
( an extension from the stx:libjavascript package )
return a timestamp.

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

general queries
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 dayNamesForLanguage:'fr'
     Date dayNamesForLanguage:'de' 

     Date dayOfWeek:'wednesday' language:'en'
     Date dayOfWeek:'Wednesday' language:'en'
     Date dayOfWeek:'Montag' language:'de'     
     Date dayOfWeek:'montag' language:'de'     
     Date dayOfWeek:'lundi' language:'fr' 

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.
The given string may be in the current language or english.
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 
     Date indexOfMonth:'Dezember' language:#de  
     Date indexOfMonth:'dezember' language:#de  
     Date indexOfMonth:'dez' language:#de   

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). => '02/12/2024' -- when us-english
Date today printStringFormat:(Date longFormatString). => 'monday, 02/12/2024'
Date today printStringFormat:(Date shortFormatString). => '02/12/2024'

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  numWeeksInYear: aYear
for a given year, return the number of calendar weeks within the year (52 or 53).
ISO 8601: years in which 1 January or 31 December are Thursdays do have 53 weeks

Usage example(s):

     Date numWeeksInYear:1900    
     Date numWeeksInYear:1900    
     Date numWeeksInYear:1998    
     Date numWeeksInYear:1999    
     Date numWeeksInYear:2000    
     Date numWeeksInYear:2001    
     Date numWeeksInYear:2002    
     Date numWeeksInYear:2003    
     Date numWeeksInYear:2004    
     Date numWeeksInYear:2005    

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  initNamesForLanguage: language
read the language specific names.

Usage example(s):

     Date initNamesForLanguage:#de.
     Date initNamesForLanguage:#de_at.
     Date initNamesForLanguage:#de_de.
     Date initNamesForLanguage:#de_auto.
     Date initNamesForLanguage:#en.
     Date initNamesForLanguage:#en_en.
     Date initNamesForLanguage:#en_au.
     Date initNamesForLanguage:#fr.
     Date initNamesForLanguage:#es.

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

     Date fromDays:-1     -> 12/31/1900
     Date fromDays:-2     -> 12/31/1900
     Date fromDays:-365   -> 01/01/1900

o  fromDaysFrom0: dayCount
return a new Date, given the day-number starting with 0 at 1.Jan 0000;
(i.e. 'Date fromDaysSince0:0' returns 1st Jan. 0000).
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  now
( an extension from the stx:libjavascript package )
return the current date

Usage example(s):

     JavaScriptParser
        evaluate:'Date.now();'     

     JavaScriptParser
        evaluate:'Date.now().getDate();'    

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:'2018-12-03' printFormat:'%y %m %d' language: #de 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 formats (yyyy-mm-dd) - as long as yyyy is > 12.
It also handles yyyymmdd and yymmdd.

It also handles short years (i.e. 2 digits), by evaluating the
UserPreferences current twoDigitDateHandler
By default, that one will convert late 90's days to 19xx, and all others to 20xx.

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'                 onError:'wrong date'.  
     Date readFrom:'2007-12-31'                 onError:'wrong date'.  
     Date readFromString:'December, 5 1992'  
     Date readFromString:'12/31/1992'           
     Date readFromString:'01/02/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']  
     Date readFromString:'20140111'  onError:['wrong date']  
     Date readFrom:'20140111'
     Date readFrom:'140111' 
     Date readFrom:'990111' 

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: monthOrMonthName 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

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: monthOrMonthName 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 

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) 
     Date fromDays:(Date today asDays + 7) 
     Date fromDays:-36889                          => 01/01/1800

o  asDaysFrom0
return the number of days elapsed since 01-Jan-0000
and the receiver's day; starts with 0 for 01-Jan-0000.
Date>>fromDaysFrom0: is the reverse operation.
Notice,
that this represents dates before 0 as negative values!

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) 

     (Date newDay: 1 month: 1 year: -1) asDaysFrom0  -> should be -365
     Date fromDaysFrom0:-365                         -> 01/01/-1

     (Date newDay: 1 month: 1 year: -10) asDaysFrom0  -> should be -3652
     Date fromDaysFrom0:-3652                         -> 01/01/-10

o  asSeconds
return the (truncated) 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  - aDateOrNumberOfDaysOrTimeDuration
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             => 03/18/2024
     Date today addDays:1   => 03/19/2024
     Date today addDays:7   => 03/25/2024

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                  => 03/18/2024
     Date today subtractDays:1   => 03/17/2024
     Date today subtractDays:7   => 03/11/2024

o  subtractMonths: numberOfMonths
Return a new instance which subtracted 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.

Usage example(s):

        Date today subtractMonths:14     
        Date today subtractMonths:15     

comparing
o  < aDate
return true, if the date represented by the receiver
is before the argument, aDate.
If compared against a timestamp, the receiver is treated like 00:00:00 midnight

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.
If compared against a timestamp, the receiver is treated like 00:00:00 midnight

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.
If compared against a timestamp, the receiver is treated like 00:00:00 midnight

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
marked as obsolete by exept MBP at 04-12-2021

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

o  addPrintBindingsTo: aDictionary language: languageOrNil
marked as obsolete by exept MBP at 04-12-2021

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

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 AbstractTime::PrintBindingMirror class >> #documentation for allowed 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:'%(DayName), %(MonthName) %d, %y' language:#en  
     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 AbstractTime::PrintBindingMirror class >> #documentation for allowed format strings

Usage example(s):

     Date today 
        printOn:Transcript 
        format: c'%y-%m-%d\n'                             
        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 AbstractTime::PrintBindingMirror class >> #documentation for allowed 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 AbstractTime::PrintBindingMirror class >> #documentation for allowed 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

testing
o  isDate
(comment from inherited method)
return true if the receiver is some kind of date;
false is returned here - the method is only redefined in Date.

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



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:51:36 GMT