|
|
6.52 Date
- Defined in namespace Smalltalk
- Category: Language-Data types
- My instances represent dates. My base date is defined to be Jan 1, 1901.
I provide methods for instance creation (including via "symbolic" dates,
such as "Date newDay: 14 month: #Feb year: 1990".
PLEASE BE WARNED -- use this class only for dates after 1582 AD; that's the
beginning of the epoch. Dates before 1582 will not be correctly printed. In
addition, since ten days were lost from October 5 through October 15,
operations between a Gregorian date (after 15-Oct-1582) and a Julian date
(before 5-Oct-1582) will give incorrect results; or, 4-Oct-1582 + 2 days will
yield 6-Oct-1582 (a non-existent day!), not 16-Oct-1582.
In fact, if you pass a year < 1582 to a method like #newDay:month:year:
it will assume that it is a two-digit year (e.g. 90=1990, 1000=2900). The only
way to create Julian calendar dates is with the #fromDays: instance creation
method.
6.52.1 Date class: basic
- abbreviationOfDay: dayIndex
- Answer the abbreviated name of the day of week corresponding to the given index
- dayOfWeek: dayName
- Answer the index of the day of week corresponding to the given name
- daysInMonth: monthName forYear: yearInteger
- Answer the number of days in the given (named) month for the given year
- daysInYear: i
- Answer the number of days in the given year
- indexOfMonth: monthName
- Answer the index of the month corresponding to the given name
- initDayNameDict
- Initialize the DayNameDict to the names of the days
- initialize
- Initialize the receiver
- initMonthNameDict
- Initialize the MonthNameDict to the names of the months
- nameOfDay: dayIndex
- Answer the name of the day of week corresponding to the given index
- nameOfMonth: monthIndex
- Answer the name of the month corresponding to the given index
- shortNameOfMonth: monthIndex
- Answer the name of the month corresponding to the given index
6.52.2 Date class: instance creation (ANSI)
- year: y day: d hour: h minute: min second: s
- Answer a Date denoting the d-th day of the given year
- year: y month: m day: d hour: h minute: min second: s
- Answer a Date denoting the d-th day of the given (as a number) month and year
6.52.3 Date class: instance creation (Blue Book)
- dateAndTimeNow
- Answer an array containing the current date and time
- fromDays: dayCount
- Answer a Date denoting dayCount days past 1/1/1901
- fromJulian: jd
- Answer a Date denoting the jd-th day in the astronomical Julian calendar.
- fromSeconds: time
- Answer a Date denoting the date time seconds past Jan 1st, 1901
- newDay: day month: monthName year: yearInteger
- Answer a Date denoting the dayCount day of the given (named) month and year
- newDay: day monthIndex: monthIndex year: yearInteger
- Answer a Date denoting the dayCount day of the given (as a number) month and year
- newDay: dayCount year: yearInteger
- Answer a Date denoting the dayCount day of the yearInteger year
- readFrom: aStream
- Parse an instance of the receiver from aStream
- today
- Answer a Date denoting the current date in local time
- utcDateAndTimeNow
- Answer an array containing the current date and time in Coordinated Universal Time (UTC)
- utcToday
- Answer a Date denoting the current date in Coordinated Universal Time (UTC)
6.52.4 Date: basic
- addDays: dayCount
- Answer a new Date pointing dayCount past the receiver
- subtractDate: aDate
- Answer the number of days between aDate and the receiver (negative if the receiver is before aDate)
- subtractDays: dayCount
- Answer a new Date pointing dayCount before the receiver
6.52.5 Date: compatibility (non-ANSI)
- day
- Answer the day represented by the receiver
- dayName
- Answer the day of week of the receiver as a Symbol
- shortMonthName
- Answer the abbreviated name of the month represented by the receiver
6.52.6 Date: date computations
- asSeconds
- Answer the date as the number of seconds from 1/1/1901.
- dayOfMonth
- Answer the day represented by the receiver (same as #day)
- dayOfWeek
- Answer the day of week of the receiver. 1 = Monday, 7 = Sunday
- dayOfWeekAbbreviation
- Answer the day of week of the receiver as a Symbol
- dayOfWeekName
- Answer the day of week of the receiver as a Symbol
- dayOfYear
- Answer the days passed since 31/12 of last year; e.g. New Year's Day is 1
- daysFromBaseDay
- Answer the days passed since 1/1/1901
- daysInMonth
- Answer the days in the month represented by the receiver
- daysInYear
- Answer the days in the year represented by the receiver
- daysLeftInMonth
- Answer the days to the end of the month represented by the receiver
- daysLeftInYear
- Answer the days to the end of the year represented by the receiver
- firstDayOfMonth
- Answer a Date representing the first day of the month represented by the receiver
- isLeapYear
- Answer whether the receiver refers to a date in a leap year.
- lastDayOfMonth
- Answer a Date representing the last day of the month represented by the receiver
- month
- Answer the month represented by the receiver
- monthAbbreviation
- Answer the abbreviated name of the month represented by the receiver
- monthName
- Answer the name of the month represented by the receiver
- year
- Answer the year represented by the receiver
6.52.7 Date: printing
- printOn: aStream
- Print a representation for the receiver on aStream
6.52.8 Date: storing
- storeOn: aStream
- Store on aStream Smalltalk code compiling to the receiver
6.52.9 Date: testing
- < aDate
- Answer whether the receiver indicates a date preceding aDate
- = aDate
- Answer whether the receiver indicates the same date as aDate
- hash
- Answer an hash value for the receievr
|