author | Claus Gittinger <cg@exept.de> |
Tue, 28 Dec 1999 15:03:48 +0100 | |
changeset 5150 | d7f854b5ede8 |
parent 4998 | 010c3ab0cdc6 |
child 5186 | ed0c5597034f |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
155 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
54 | 13 |
Magnitude subclass:#Date |
972 | 14 |
instanceVariableNames:'dateEncoding' |
15 |
classVariableNames:'DayNames MonthNames DayAbbrevs MonthAbbrevs EnvironmentChange' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Magnitude-General' |
|
1 | 18 |
! |
19 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
20 |
!Date class methodsFor:'documentation'! |
54 | 21 |
|
88 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
155 | 25 |
All Rights Reserved |
88 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
54 | 36 |
documentation |
37 |
" |
|
92 | 38 |
Instances of Date represent dates as year, month and day encoded in the |
39 |
(private & hidden) instance dateEncoding. The value found there is |
|
40 |
year*100*100 + month*100 + day (which makes magnitude-like comparison of |
|
41 |
dates easy, but is not guaranteed for future versions). |
|
1228 | 42 |
Do not depend on the internal representation. |
54 | 43 |
|
92 | 44 |
The old representation used days since 1st Jan. 1901 internally - |
45 |
with the new implementation, it is possible to reasonably represent almost |
|
46 |
any Date. (which insurance companies will like, since they can now |
|
47 |
represent even very old peoples birthday :-) |
|
68 | 48 |
Notice: no correction for pre-Julian dates is done. |
54 | 49 |
|
92 | 50 |
The printed representation of dates is controlled by resource definitions - |
51 |
thus national variants are already supported (see file 'resources/Date.rs'). |
|
52 |
||
53 |
Compatibility notice: |
|
1228 | 54 |
due to some historic reasons, there are some methods found twice |
55 |
with different names in this class. The old ST/X methods will vanish in |
|
56 |
one of the next releases, and kept for a while to support existing |
|
57 |
applications (the info on how these methods should be named came |
|
58 |
somewhat late from the testers ..). |
|
92 | 59 |
|
1228 | 60 |
Please do not use methods marked as obsolete in their comment. |
92 | 61 |
|
62 |
Most useful methods: |
|
63 |
||
1228 | 64 |
Date today |
65 |
(Date today) addDays: |
|
66 |
(Date today) subtractDays: |
|
1295 | 67 |
|
68 |
[author:] |
|
69 |
Claus Gittinger |
|
70 |
||
71 |
[see also:] |
|
72 |
Time AbstractTime |
|
73 |
Filename |
|
74 |
OperatingSystem |
|
54 | 75 |
" |
76 |
! ! |
|
77 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
78 |
!Date class methodsFor:'instance creation'! |
699 | 79 |
|
80 |
fromDays:dayCount |
|
81 |
"return a new Date, given the day-number starting with 0 at 1.Jan 1901; |
|
82 |
(i.e. 'Date fromDays:0' returns 1st Jan. 1901). |
|
83 |
Date asDays is the reverse operation. |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
84 |
Added for GNU/ST-80 compatibility" |
699 | 85 |
|
86 |
|yr rest d| |
|
87 |
||
88 |
"approx. year" |
|
89 |
yr := (dayCount // 366) + 1901. |
|
90 |
rest := dayCount - (self yearAsDays:yr) + 1. "+1 for ST-80 compatibility" |
|
91 |
d := self daysInYear:yr. |
|
92 |
(rest > d) ifTrue:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
93 |
"adjust" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
94 |
yr := yr + 1. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
95 |
rest := rest - d. |
699 | 96 |
]. |
97 |
||
1501 | 98 |
^ self newDay:rest year:yr |
699 | 99 |
|
100 |
" |
|
101 |
Date fromDays:0 -> 1 jan 1901 |
|
102 |
Date fromDays:365 -> 1 jan 1902 |
|
103 |
Date fromDays:730 -> 1 jan 1903 |
|
104 |
Date fromDays:1095 -> 1 jan 1903 |
|
105 |
Date fromDays:1460 ->31 dec 1904 since 1904 was a leap year |
|
106 |
" |
|
107 |
||
1501 | 108 |
"Modified: 1.7.1996 / 14:24:25 / cg" |
699 | 109 |
! |
110 |
||
111 |
newDay:day month:month year:year |
|
112 |
"return a new Date, given the day, month and year. |
|
113 |
For your convenience, month may be either an integer |
|
114 |
or the months name as a string. |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
115 |
|
699 | 116 |
Year may be the actual year (such as 1890, 2001) or the number |
117 |
of years since 1900 (which is rubbish ST-80 compatibility: |
|
118 |
it will be totally useless in a few years ...). |
|
119 |
You better not use this short-year feature in your programs." |
|
120 |
||
121 |
|monthIndex ok yr| |
|
122 |
||
123 |
yr := year. |
|
124 |
yr < 100 ifTrue:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
125 |
yr := yr + 1900. |
699 | 126 |
]. |
127 |
||
128 |
month isInteger ifTrue:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
129 |
monthIndex := month |
699 | 130 |
] ifFalse:[ |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
131 |
monthIndex := self indexOfMonth:month |
699 | 132 |
]. |
133 |
(monthIndex == 2 and:[day == 29]) ifTrue:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
134 |
ok := self leapYear:yr |
699 | 135 |
] ifFalse:[ |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
136 |
ok := day <= (self daysInMonth:month forYear:yr) |
699 | 137 |
]. |
138 |
((day > 0) and:[ok]) ifTrue:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
139 |
^ self basicNew dateEncoding:(((yr * 100) + monthIndex) * 100) + day |
699 | 140 |
]. |
141 |
||
142 |
"this error is triggered if you try to create a date from an |
|
143 |
invalid year/month/day combination; |
|
144 |
Such as 29-feb-year, where year is no leap year |
|
145 |
" |
|
146 |
self error:'invalid date' |
|
147 |
||
148 |
" |
|
149 |
Date newDay:8 month:'may' year:1993 |
|
150 |
Date newDay:8 month:5 year:1994 |
|
151 |
Date newDay:29 month:'feb' year:1994 |
|
152 |
Date newDay:29 month:'feb' year:1993 |
|
153 |
Date newDay:28 month:'feb' year:5 |
|
154 |
Date newDay:28 month:'feb' year:95 |
|
155 |
" |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
156 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
157 |
"Modified: 19.4.1996 / 15:28:15 / cg" |
699 | 158 |
! |
159 |
||
160 |
newDay:dayInYear year:year |
|
161 |
"return a new Date, given the year and the day-in-year (starting at 1). |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
162 |
See also: Date today / Time now / AbsoluteTime now. |
699 | 163 |
ST-80 compatibility" |
164 |
||
165 |
|monthAndDay| |
|
166 |
||
167 |
(dayInYear between:1 and:365) ifFalse:[ |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
168 |
((dayInYear == 366) and:[self leapYear:year]) ifFalse:[ |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
169 |
" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
170 |
this error is triggered, when you try to create a |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
171 |
day from an invalid day-in-year; |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
172 |
for example, 366 in a non-leap year. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
173 |
I dont know, if ST-80 wraps to the next year(s) in this case. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
174 |
" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
175 |
^ self error:'invalid date' |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
176 |
] |
699 | 177 |
]. |
178 |
monthAndDay := self monthAndDayFromDayInYear:dayInYear forYear:year. |
|
1501 | 179 |
^ self newDay:(monthAndDay at:2) month:(monthAndDay at:1) year:year |
699 | 180 |
|
181 |
" |
|
182 |
Date newDay:150 year:1994 |
|
183 |
Date newDay:1 year:1994 |
|
184 |
Date newDay:1 year:1901 |
|
185 |
Date newDay:1 year:1902 |
|
186 |
Date newDay:365 year:1992 |
|
187 |
Date newDay:366 year:1992 |
|
188 |
Date newDay:365 year:1994 |
|
189 |
Date newDay:366 year:1994 |
|
190 |
" |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
191 |
|
1501 | 192 |
"Modified: 1.7.1996 / 14:22:24 / cg" |
699 | 193 |
! |
194 |
||
195 |
readFrom:aStringOrStream onError:exceptionBlock |
|
196 |
"return a new Date, reading a printed representation from aStream. |
|
197 |
Notice, that this is not the storeString format and |
|
198 |
is different from the format expected by readFrom:. |
|
199 |
BUG: |
|
200 |
This method assumes american format (i.e. month-day-year) instead |
|
201 |
of the german/french and other day-month-year. |
|
4998 | 202 |
There ought to be a internationalized variant of this." |
699 | 203 |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
204 |
|newDate| |
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
205 |
|
972 | 206 |
ErrorSignal handle:[:ex | |
207 |
^ exceptionBlock value |
|
699 | 208 |
] do:[ |
1701
80d13adb2e77
better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
1501
diff
changeset
|
209 |
|str month day year| |
972 | 210 |
str := aStringOrStream readStream. |
699 | 211 |
|
972 | 212 |
[str peek isLetterOrDigit] whileFalse:[str next]. |
213 |
(str peek isDigit) ifTrue:[ |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
214 |
day := Integer readFrom:str |
972 | 215 |
]. |
216 |
[str peek isLetterOrDigit] whileFalse:[str next]. |
|
217 |
(str peek isLetter) ifTrue:[ |
|
218 |
month := str nextAlphaNumericWord. |
|
219 |
day isNil ifTrue:[ |
|
220 |
[str peek isLetterOrDigit] whileFalse:[str next]. |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
221 |
day := Integer readFrom:str. |
972 | 222 |
] |
223 |
] ifFalse:[ |
|
224 |
month := self nameOfMonth:day. |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
225 |
day := Integer readFrom:str |
972 | 226 |
]. |
227 |
[str peek isLetterOrDigit] whileFalse:[str next]. |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
228 |
year := Integer readFrom:str. |
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
229 |
|
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
230 |
newDate := self newDay:day month:month year:year |
699 | 231 |
]. |
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
232 |
^ newDate |
699 | 233 |
|
234 |
" |
|
235 |
Date readFromString:'31 December 1992' |
|
4997 | 236 |
Date readFrom:'19:11:1999' |
237 |
Date readFromString:'December, 5 1992' |
|
238 |
Date readFromString:'3-jan-95' |
|
239 |
Date readFromString:'12/31/1992' |
|
240 |
Date readFromString:'15.4.1992' -> german; leads to an error |
|
241 |
Date readFromString:'10.4.1992' -> german; leads to a wrong date |
|
242 |
Date readFromString:'10.4.1992' onError:['wrong date'] |
|
243 |
Date readFromString:'32.4.1992' onError:['wrong date'] |
|
244 |
Date readFromString:'fooBar' onError:['wrong date'] |
|
245 |
Date readFromString:'10.4' onError:['wrong date'] |
|
246 |
Date readFromString:'10041999' onError:['wrong date'] |
|
247 |
" |
|
248 |
||
249 |
"Created: 16.11.1995 / 22:50:17 / cg" |
|
250 |
"Modified: 8.10.1996 / 19:25:39 / cg" |
|
251 |
! |
|
252 |
||
253 |
readFrom:aStringOrStream printFormat:aFormatArray |
|
254 |
"return a new Date, reading a printed representation from aStream. |
|
255 |
1 day position (1, 2 or 3) |
|
256 |
2 month position (1..3) |
|
257 |
3 year position (1..3) |
|
258 |
" |
|
259 |
^ self readFrom:aStringOrStream |
|
260 |
printFormat:aFormatArray |
|
261 |
onError:[self error:'expected: ' , self name] |
|
262 |
||
263 |
" |
|
264 |
Date readFrom:'19:11:1999' printFormat:#( 1 2 3 ) |
|
265 |
Date readFrom:'19-nov-1999' printFormat:#( 1 2 3 ) |
|
266 |
Date readFrom:'19:11:1999' printFormat:#( 2 1 3 ) -> exception: wrong month |
|
267 |
Date readFrom:'5:12:1999' printFormat:#( 2 1 3 ) |
|
268 |
Date readFrom:'may-12-1999' printFormat:#( 2 1 3 ) |
|
269 |
Date readFrom:'1999 may 12' printFormat:#( 3 2 1 ) |
|
270 |
" |
|
271 |
||
272 |
"Created: 16.11.1995 / 22:50:17 / cg" |
|
273 |
"Modified: 8.10.1996 / 19:25:39 / cg" |
|
274 |
! |
|
275 |
||
276 |
readFrom:aStringOrStream printFormat:aFormatArray onError:exceptionBlock |
|
277 |
"return a new Date, reading a printed representation from aStream. |
|
278 |
1 day position (1, 2 or 3) |
|
279 |
2 month position (1..3) |
|
280 |
3 year position (1..3) |
|
281 |
" |
|
282 |
|newDate| |
|
283 |
||
284 |
ErrorSignal handle:[:ex | |
|
285 |
^ exceptionBlock value |
|
286 |
] do:[ |
|
287 |
|str arg| |
|
288 |
||
289 |
str := aStringOrStream readStream. |
|
290 |
arg := Array new:3. |
|
291 |
||
292 |
1 to:3 do:[:i||v| |
|
293 |
[str peek isLetterOrDigit] whileFalse:[str next]. |
|
294 |
||
295 |
v := (str peek isDigit) ifTrue:[Integer readFrom:str] |
|
296 |
ifFalse:[str nextAlphaNumericWord]. |
|
297 |
arg at:i put:v |
|
298 |
]. |
|
299 |
newDate := self newDay:(arg at:(aFormatArray at:1)) |
|
300 |
month:(arg at:(aFormatArray at:2)) |
|
301 |
year:(arg at:(aFormatArray at:3)) |
|
302 |
]. |
|
303 |
^ newDate |
|
304 |
||
305 |
" |
|
306 |
Date readFromString:'31 December 1992' |
|
307 |
Date readFrom:'19:11:1999' |
|
699 | 308 |
Date readFromString:'December, 5 1992' |
309 |
Date readFromString:'3-jan-95' |
|
310 |
Date readFromString:'12/31/1992' |
|
311 |
Date readFromString:'15.4.1992' -> german; leads to an error |
|
312 |
Date readFromString:'10.4.1992' -> german; leads to a wrong date |
|
313 |
Date readFromString:'10.4.1992' onError:['wrong date'] |
|
3995
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
314 |
Date readFromString:'32.4.1992' onError:['wrong date'] |
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
315 |
Date readFromString:'fooBar' onError:['wrong date'] |
777470826394
no need for another error-handler blcok in #readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
3257
diff
changeset
|
316 |
Date readFromString:'10.4' onError:['wrong date'] |
4421 | 317 |
Date readFromString:'10041999' onError:['wrong date'] |
318 |
" |
|
319 |
||
320 |
"Created: 16.11.1995 / 22:50:17 / cg" |
|
321 |
"Modified: 8.10.1996 / 19:25:39 / cg" |
|
322 |
! |
|
323 |
||
324 |
readMMDDYYYYFrom:aStringOrStream onError:exceptionBlock |
|
325 |
"return a new Date, reading a printed representation from aStream. |
|
326 |
Notice, that this is not the storeString format and |
|
4998 | 327 |
is different from the format expected by readFrom:" |
4421 | 328 |
|
329 |
|newDate| |
|
330 |
||
331 |
ErrorSignal handle:[:ex | |
|
332 |
^ exceptionBlock value |
|
333 |
] do:[ |
|
334 |
|str month day year| |
|
335 |
||
336 |
str := aStringOrStream readStream. |
|
337 |
month := str next:2. |
|
338 |
month := Integer readFrom:month. |
|
339 |
day := str next:2. |
|
340 |
day := Integer readFrom:day. |
|
341 |
year := str next:4. |
|
342 |
year := Integer readFrom:year. |
|
343 |
||
344 |
newDate := self newDay:day month:month year:year |
|
345 |
]. |
|
346 |
^ newDate |
|
347 |
||
348 |
" |
|
349 |
Date readMMDDYYYYFrom:'10041999' onError:['wrong date'] |
|
699 | 350 |
" |
351 |
||
352 |
"Created: 16.11.1995 / 22:50:17 / cg" |
|
1701
80d13adb2e77
better errorHandling in readFrom:onError:
Claus Gittinger <cg@exept.de>
parents:
1501
diff
changeset
|
353 |
"Modified: 8.10.1996 / 19:25:39 / cg" |
699 | 354 |
! |
355 |
||
356 |
today |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
357 |
"return a date, representing today. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
358 |
See also: Time now / AbsoluteTime now." |
699 | 359 |
|
1501 | 360 |
^ self fromOSTime:(OperatingSystem getOSTime) |
699 | 361 |
|
362 |
" |
|
363 |
Date today |
|
364 |
" |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
365 |
|
1501 | 366 |
"Modified: 1.7.1996 / 15:20:16 / cg" |
699 | 367 |
! ! |
368 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
369 |
!Date class methodsFor:'general queries'! |
699 | 370 |
|
371 |
abbreviatedNameOfDay:dayIndex |
|
372 |
"given a day index (1..7), return the abbreviated name |
|
373 |
of the day" |
|
374 |
||
375 |
EnvironmentChange ifTrue:[ |
|
376 |
self initNames |
|
377 |
]. |
|
378 |
^ DayAbbrevs at:dayIndex |
|
379 |
||
380 |
" |
|
381 |
Date abbreviatedNameOfDay:4 |
|
382 |
" |
|
383 |
! |
|
384 |
||
385 |
abbreviatedNameOfMonth:monthIndex |
|
386 |
"given a month index (1..12), return the abbreviated name |
|
387 |
of the month" |
|
388 |
||
389 |
EnvironmentChange ifTrue:[ |
|
390 |
self initNames |
|
391 |
]. |
|
392 |
^ MonthAbbrevs at:monthIndex |
|
393 |
||
394 |
" |
|
395 |
Date abbreviatedNameOfMonth:11 |
|
396 |
Date abbreviatedNameOfMonth:12 |
|
397 |
" |
|
398 |
! |
|
399 |
||
400 |
dateAndTimeNow |
|
401 |
"return an array containing the date and time of now" |
|
402 |
||
403 |
^ Time dateAndTimeNow |
|
404 |
||
405 |
" |
|
406 |
Date dateAndTimeNow |
|
407 |
" |
|
408 |
! |
|
409 |
||
410 |
dayOfWeek:dayName |
|
411 |
"given the name of a day (either string or symbol), |
|
412 |
return the day-index (1 for monday; 7 for sunday). |
|
413 |
Return 0 for invalid day name" |
|
414 |
||
415 |
EnvironmentChange ifTrue:[ |
|
416 |
self initNames |
|
417 |
]. |
|
418 |
^ DayNames indexOf:dayName |
|
419 |
||
420 |
" |
|
421 |
Date dayOfWeek:'wednesday' |
|
422 |
" |
|
423 |
! |
|
424 |
||
425 |
daysInMonth:month forYear:yearInteger |
|
426 |
"given the name of a month and a year, return the number |
|
427 |
of days this month has (modified GNU). |
|
428 |
return 0 if the month name was invalid. |
|
429 |
For your convenience, month maybe an integer or name-string." |
|
430 |
||
431 |
|monthIndex "{ Class: SmallInteger }"| |
|
432 |
||
433 |
month isInteger ifTrue:[ |
|
434 |
monthIndex := month |
|
435 |
] ifFalse:[ |
|
436 |
monthIndex := self indexOfMonth:month |
|
437 |
]. |
|
438 |
||
439 |
^ self daysInMonthIndex:monthIndex forYear:yearInteger |
|
440 |
||
441 |
" |
|
442 |
Date daysInMonth:2 forYear:1980 |
|
443 |
Date daysInMonth:2 forYear:1981 |
|
444 |
Date daysInMonth:'feb' forYear:1981 |
|
445 |
" |
|
446 |
! |
|
447 |
||
448 |
daysInYear:yearInteger |
|
449 |
"return the number of days in a year" |
|
450 |
||
451 |
(self leapYear:yearInteger) ifTrue:[^ 366]. |
|
452 |
^ 365 |
|
453 |
||
454 |
" |
|
455 |
Date daysInYear:1900 |
|
456 |
Date daysInYear:1901 |
|
457 |
Date daysInYear:1904 |
|
458 |
Date daysInYear:1980 |
|
459 |
Date daysInYear:1981 |
|
460 |
" |
|
461 |
! |
|
462 |
||
463 |
daysUntilMonth:month forYear:yearInteger |
|
464 |
"given the name of a month and a year, return the number |
|
465 |
of days from 1st january to last of prev month of that year. |
|
466 |
Return 0 if the month name/index is invalid or is january. |
|
467 |
For your convenience, month maybe an integer or name-string." |
|
468 |
||
469 |
|monthIndex "{ Class: SmallInteger }" |
|
470 |
sumDays "{ Class: SmallInteger }" | |
|
471 |
||
472 |
month isInteger ifTrue:[ |
|
473 |
monthIndex := month |
|
474 |
] ifFalse:[ |
|
475 |
monthIndex := self indexOfMonth:month |
|
476 |
]. |
|
477 |
(monthIndex between:1 and:12) ifFalse:[^ 0]. |
|
478 |
||
479 |
sumDays := 0. |
|
480 |
1 to:monthIndex-1 do:[:m | |
|
481 |
sumDays := sumDays + (self daysInMonthIndex:m forYear:yearInteger) |
|
482 |
]. |
|
483 |
^ sumDays |
|
484 |
||
485 |
" |
|
486 |
Date daysUntilMonth:'feb' forYear:1993 |
|
487 |
Date daysUntilMonth:'jan' forYear:1993 |
|
488 |
" |
|
489 |
! |
|
490 |
||
491 |
indexOfMonth:aMonthString |
|
492 |
"given the name of a month (either string or symbol), |
|
493 |
return the month-index (1 for jan; 12 for december). |
|
494 |
The given string may be a full or abbreviated name, |
|
495 |
case is ignored. |
|
496 |
Return 0 for invalid month name." |
|
497 |
||
498 |
|idx name| |
|
499 |
||
500 |
EnvironmentChange ifTrue:[ |
|
501 |
self initNames |
|
502 |
]. |
|
503 |
name := aMonthString asLowercase. |
|
504 |
idx := MonthAbbrevs indexOf:name. |
|
505 |
idx ~~ 0 ifTrue:[^ idx]. |
|
506 |
idx := MonthNames indexOf:name. |
|
507 |
idx ~~ 0 ifTrue:[^ idx]. |
|
508 |
||
509 |
name at:1 put:(name at:1) asUppercase. |
|
510 |
idx := MonthAbbrevs indexOf:name. |
|
511 |
idx ~~ 0 ifTrue:[^ idx]. |
|
512 |
idx := MonthNames indexOf:name. |
|
513 |
idx ~~ 0 ifTrue:[^ idx]. |
|
514 |
||
515 |
^ idx |
|
516 |
||
517 |
" |
|
518 |
Date indexOfMonth:'jan' |
|
519 |
Date indexOfMonth:'Jan' |
|
520 |
Date indexOfMonth:'December' |
|
521 |
" |
|
522 |
! |
|
523 |
||
524 |
isLeapYear:yearInteger |
|
525 |
"Return true, if a year is a leap year. |
|
526 |
Obsolete: |
|
527 |
Please use the ST-80 compatible #leapYear for new programs, |
|
528 |
since this method will vanish." |
|
529 |
||
530 |
^ self leapYear:yearInteger |
|
531 |
! |
|
532 |
||
533 |
leapYear:yearInteger |
|
534 |
"return true, if yearInteger is a leap year." |
|
535 |
||
536 |
|y "{ Class: SmallInteger }"| |
|
537 |
||
538 |
y := yearInteger. |
|
539 |
(y \\ 4 == 0) ifTrue:[ |
|
540 |
(y \\ 100 ~~ 0) ifTrue:[^ true]. |
|
541 |
(y \\ 400 == 0) ifTrue:[^ true] |
|
542 |
]. |
|
543 |
^ false |
|
544 |
||
545 |
" |
|
546 |
Date leapYear:1992 |
|
547 |
Date leapYear:1994 |
|
548 |
Date leapYear:1900 |
|
549 |
Date leapYear:2000 |
|
550 |
" |
|
551 |
! |
|
552 |
||
553 |
monthAndDayFromDayInYear:aDayInYear forYear:yearInteger |
|
554 |
"given a day-in-year (1..365) return an Array containing the |
|
555 |
month index and the day-in-month. Return nil if the argument is invalid." |
|
556 |
||
557 |
|restDays daysInMonth| |
|
558 |
||
559 |
restDays := aDayInYear. |
|
560 |
restDays < 1 ifTrue:[^ nil]. |
|
561 |
||
562 |
1 to:12 do:[:m | |
|
563 |
daysInMonth := self daysInMonthIndex:m forYear:yearInteger. |
|
564 |
restDays <= daysInMonth ifTrue:[ |
|
565 |
^ Array with:m with:restDays |
|
566 |
]. |
|
567 |
restDays := restDays - daysInMonth |
|
568 |
]. |
|
569 |
restDays > daysInMonth ifTrue:[^ nil]. |
|
570 |
^ Array with:12 with:restDays |
|
571 |
||
572 |
" |
|
573 |
Date monthAndDayFromDayInYear:66 forYear:1980 |
|
574 |
Date monthAndDayFromDayInYear:66 forYear:1981 |
|
575 |
" |
|
576 |
! |
|
577 |
||
578 |
nameOfDay:dayIndex |
|
579 |
"given a day index (1..7), return the name of the day" |
|
580 |
||
581 |
EnvironmentChange ifTrue:[ |
|
582 |
self initNames |
|
583 |
]. |
|
584 |
^ DayNames at:dayIndex |
|
585 |
||
586 |
" |
|
587 |
Date nameOfDay:4 |
|
588 |
" |
|
589 |
! |
|
590 |
||
591 |
nameOfMonth:monthIndex |
|
592 |
"given a month index (1..12), return the name of the month" |
|
593 |
||
594 |
EnvironmentChange ifTrue:[ |
|
595 |
self initNames |
|
596 |
]. |
|
597 |
^ MonthNames at:monthIndex |
|
598 |
||
599 |
" |
|
600 |
Date nameOfMonth:11 |
|
601 |
Date nameOfMonth:12 |
|
602 |
Date nameOfMonth:4 |
|
603 |
" |
|
604 |
! |
|
605 |
||
606 |
yearAsDays: yearInteger |
|
607 |
"Returns the number of days since Jan 1, 1901. (GNU) |
|
608 |
to the first Jan of the year, yearInteger. |
|
609 |
For 1901 this is zero, for 1902 its 365. |
|
610 |
Defined for years >= 1901" |
|
611 |
||
612 |
|y "{ Class: SmallInteger }"| |
|
613 |
||
614 |
y := yearInteger - 1900. |
|
615 |
y := y - 1. |
|
616 |
^ (y * 365) |
|
617 |
+ (y // 4) |
|
618 |
- (y // 100) |
|
619 |
+ ((y + 300) // 400) |
|
620 |
||
621 |
" |
|
622 |
Date yearAsDays:1901 |
|
623 |
Date yearAsDays:1902 |
|
624 |
Date yearAsDays:1903 |
|
625 |
Date yearAsDays:1904 |
|
626 |
Date yearAsDays:1905 |
|
627 |
Date yearAsDays:1994 |
|
628 |
(Date yearAsDays:2001) - (Date yearAsDays:2000) |
|
629 |
" |
|
630 |
! ! |
|
631 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
632 |
!Date class methodsFor:'handling language changes'! |
699 | 633 |
|
634 |
initialize |
|
635 |
"check for case where Resource-classes are absent" |
|
636 |
ResourcePack isNil ifTrue:[ |
|
637 |
self initNames |
|
638 |
] ifFalse:[ |
|
639 |
Smalltalk addDependent:self. |
|
640 |
EnvironmentChange := true |
|
641 |
] |
|
642 |
! |
|
643 |
||
1468 | 644 |
update:something with:aParameter from:changedObject |
699 | 645 |
((something == #Language) or:[something == #LanguageTerritory]) ifTrue:[ |
1468 | 646 |
"just remember change for next access" |
647 |
EnvironmentChange := true |
|
699 | 648 |
] |
1468 | 649 |
|
650 |
"Created: 15.6.1996 / 15:19:25 / cg" |
|
699 | 651 |
! ! |
652 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
653 |
!Date class methodsFor:'obsolete instance creation'! |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
654 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
655 |
day:day month:month year:year |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
656 |
"return a new Date, given the day, month and year. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
657 |
Obsolete: |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
658 |
use newDay:month:year: for ST-80 compatibility" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
659 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
660 |
^ self newDay:day month:month year:year |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
661 |
! |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
662 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
663 |
day:dayInYear year:year |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
664 |
"return a new Date, given the year and the day-in-year (starting at 1). |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
665 |
Obsolete: |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
666 |
use newDay:year: for ST-80 compatibility" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
667 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
668 |
^ self newDay:dayInYear year:year |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
669 |
! ! |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
670 |
|
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
671 |
!Date class methodsFor:'private'! |
1 | 672 |
|
699 | 673 |
daysInMonthIndex: monthIndex forYear: yearInteger |
674 |
"return the number of days in month monthIndex of |
|
675 |
year yearInteger (modified GNU). |
|
676 |
Return 0 for invalid month index. |
|
677 |
This is the internal version of daysInMonth:forYear:" |
|
678 |
||
679 |
|days| |
|
680 |
||
681 |
(monthIndex between:1 and:12) ifFalse:[^ 0]. |
|
682 |
||
683 |
days := #(31 28 31 "Jan Feb Mar" |
|
684 |
30 31 30 "Apr May Jun" |
|
685 |
31 31 30 "Jul Aug Sep" |
|
686 |
31 30 31 "Oct Nov Dec" |
|
687 |
) at: monthIndex. |
|
688 |
||
689 |
(monthIndex == 2) ifTrue:[ |
|
690 |
(self leapYear:yearInteger) ifTrue:[ |
|
691 |
^ days + 1 |
|
692 |
] |
|
693 |
]. |
|
694 |
^ days |
|
695 |
||
696 |
" |
|
697 |
Date daysInMonthIndex:2 forYear:1994 |
|
698 |
Date daysInMonthIndex:2 forYear:1980 |
|
699 |
Date daysInMonthIndex:2 forYear:1981 |
|
700 |
" |
|
701 |
! |
|
702 |
||
1 | 703 |
initNames |
704 |
"read the language specific names" |
|
705 |
||
10 | 706 |
|resources| |
707 |
||
54 | 708 |
DayNames := #('monday' |
155 | 709 |
'tuesday' |
710 |
'wednesday' |
|
711 |
'thursday' |
|
712 |
'friday' |
|
713 |
'saturday' |
|
714 |
'sunday'). |
|
1 | 715 |
|
54 | 716 |
DayAbbrevs := #('mon' |
155 | 717 |
'tue' |
718 |
'wed' |
|
719 |
'thu' |
|
720 |
'fri' |
|
721 |
'sat' |
|
722 |
'sun'). |
|
1 | 723 |
|
54 | 724 |
MonthNames := #('january' |
155 | 725 |
'february' |
726 |
'march' |
|
727 |
'april' |
|
728 |
'may' |
|
729 |
'june' |
|
730 |
'july' |
|
731 |
'august' |
|
732 |
'september' |
|
733 |
'october' |
|
734 |
'november' |
|
735 |
'december'). |
|
1 | 736 |
|
54 | 737 |
MonthAbbrevs := #('jan' |
155 | 738 |
'feb' |
739 |
'mar' |
|
740 |
'apr' |
|
741 |
'may' |
|
742 |
'jun' |
|
743 |
'jul' |
|
744 |
'aug' |
|
745 |
'sep' |
|
746 |
'oct' |
|
747 |
'nov' |
|
748 |
'dec'). |
|
54 | 749 |
|
750 |
"check for case where Resource-classes are absent" |
|
751 |
ResourcePack notNil ifTrue:[ |
|
155 | 752 |
resources := ResourcePack for:self. |
54 | 753 |
|
155 | 754 |
DayNames := resources array:DayNames. |
755 |
DayAbbrevs := resources array:DayAbbrevs. |
|
756 |
MonthNames := resources array:MonthNames. |
|
757 |
MonthAbbrevs := resources array:MonthAbbrevs. |
|
54 | 758 |
]. |
1 | 759 |
|
29 | 760 |
EnvironmentChange := false |
10 | 761 |
|
762 |
"Date initNames" |
|
54 | 763 |
! ! |
764 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
765 |
!Date class methodsFor:'private encoding'! |
54 | 766 |
|
767 |
encodeYear:y month:m day:d |
|
92 | 768 |
"the internal encoding is stricktly private, |
769 |
and should not be used outside." |
|
770 |
||
54 | 771 |
^ (((y * 100) + m) * 100) + d |
772 |
! ! |
|
773 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
774 |
!Date class methodsFor:'private instance creation'! |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
775 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
776 |
fromOSTime:osTime |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
777 |
"return a date, representing the date given by the operatingSystem time. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
778 |
This somewhat clumsy implementation hides the OS's date representation |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
779 |
(i.e. makes this class independent of what the OS starts its time values with). |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
780 |
Dont use this method, the osTime representation is totally unportable." |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
781 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
782 |
^ self basicNew fromOSTime:osTime |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
783 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
784 |
" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
785 |
Date fromOSTime:#(0 0) -> on UNIX: this should return 1st Jan 1970 |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
786 |
thats where Unix time starts |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
787 |
On other systems, it may be something different. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
788 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
789 |
Date fromOSTime:#(86400 0) -> on UNIX: the day after |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
790 |
" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
791 |
! ! |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
792 |
|
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
793 |
!Date methodsFor:'ST80 compatibility'! |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
794 |
|
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
795 |
shortPrintString |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
796 |
"dummy - for now" |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
797 |
|
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
798 |
^ self printString |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
799 |
|
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
800 |
"Created: 20.6.1997 / 17:16:48 / cg" |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
801 |
! ! |
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
802 |
|
4407 | 803 |
!Date methodsFor:'Squeak compatibility'! |
804 |
||
805 |
mmddyyyy |
|
4462 | 806 |
"return a printed representation of the receiver in the |
807 |
form mmddyyyy. |
|
808 |
The receiver can be reconstructed with: |
|
809 |
Date readMMDDYYYYFrom:aStringOrStream onError:[...]" |
|
810 |
||
4407 | 811 |
^ (self month printStringLeftPaddedTo:2 with:$0) |
812 |
, (self day printStringLeftPaddedTo:2 with:$0) |
|
813 |
, (self year printStringLeftPaddedTo:4 with:$0) |
|
814 |
||
815 |
" |
|
816 |
Date today mmddyyyy |
|
817 |
" |
|
818 |
! ! |
|
819 |
||
699 | 820 |
!Date methodsFor:'accessing'! |
241 | 821 |
|
699 | 822 |
abbreviatedDayName |
823 |
"return the short week-day of the receiver as a string. |
|
824 |
The returned string depends on the language setting. |
|
825 |
Expect things like 'mon', 'tue' ..." |
|
54 | 826 |
|
699 | 827 |
^ self class abbreviatedNameOfDay:(self dayInWeek) |
92 | 828 |
|
829 |
" |
|
699 | 830 |
Date today abbreviatedDayName |
831 |
(Date day:15 month:4 year:1959) abbreviatedDayName |
|
92 | 832 |
" |
833 |
! |
|
834 |
||
699 | 835 |
abbreviatedMonthName |
836 |
"return the month of the receiver as a string. |
|
837 |
The returned string depends on the language setting. |
|
838 |
Expect things like 'jan', 'feb' ..." |
|
54 | 839 |
|
699 | 840 |
^ self class abbreviatedNameOfMonth:(self month) |
68 | 841 |
|
92 | 842 |
" |
699 | 843 |
Date today abbreviatedMonthName |
844 |
(Date day:15 month:4 year:1959) abbreviatedMonthName |
|
92 | 845 |
" |
846 |
! |
|
847 |
||
848 |
asDays |
|
849 |
"return the number of days elapsed since 01-Jan-1901 |
|
850 |
and the receiver's day; starts with 0 for 1-1-1901. |
|
851 |
Date>>fromDays: is the reverse operation. |
|
852 |
For ST-80 compatibility." |
|
68 | 853 |
|
854 |
|yr| |
|
855 |
||
856 |
yr := self year. |
|
857 |
^ (self class yearAsDays:yr) |
|
858 |
+ (self class daysUntilMonth:self month forYear:yr) |
|
859 |
+ self day |
|
85 | 860 |
- 1 |
68 | 861 |
|
92 | 862 |
" |
863 |
(Date day: 5 month: 8 year: 1962) asDays -> should be 22496 |
|
864 |
(Date day: 1 month: 1 year: 1901) asDays -> 0 |
|
865 |
Date today asDays |
|
866 |
Date fromDays:(Date today asDays + 7) |
|
867 |
" |
|
77 | 868 |
! |
869 |
||
870 |
asSeconds |
|
92 | 871 |
"return the seconds between 1.jan.1901 and the same time in the receivers |
872 |
day. (i.e. midnight to midnight). |
|
1501 | 873 |
This does not include any leapSeconds ... strictly speaking, this is incorrect. |
77 | 874 |
ST-80 compatibility." |
875 |
||
92 | 876 |
^ 60*60*24 * self asDays |
77 | 877 |
|
92 | 878 |
" |
879 |
(Date day: 5 month: 8 year: 1962) asSeconds |
|
880 |
(Date day: 1 month: 1 year: 1901) asSeconds |
|
881 |
(Date today addDays:7) asSeconds - Date today asSeconds |
|
1501 | 882 |
" |
883 |
||
884 |
"Modified: 1.7.1996 / 14:19:17 / cg" |
|
699 | 885 |
! |
886 |
||
887 |
day |
|
888 |
"return the day (1..31) of the receiver" |
|
889 |
||
890 |
^ dateEncoding \\ 100 |
|
891 |
||
892 |
" |
|
893 |
Date today day |
|
894 |
" |
|
895 |
! |
|
896 |
||
897 |
dayCount |
|
898 |
"return the number of days since 1st. Jan. 1901; |
|
899 |
starting with 0 for this date. |
|
900 |
Date>>fromDays: is the reverse operation. |
|
901 |
Obsolete: |
|
902 |
please use asDays for ST-80 compatibility" |
|
903 |
||
904 |
^ self asDays. |
|
905 |
||
906 |
" |
|
907 |
(Date day:1 month:1 year:1901) dayCount |
|
908 |
Date fromDays:(Date day:1 month:1 year:1994) dayCount |
|
909 |
Date today dayCount |
|
910 |
" |
|
911 |
! |
|
912 |
||
913 |
dayInWeek |
|
914 |
"return the week-day of the receiver - 1 for monday, 7 for sunday" |
|
915 |
||
3256
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
916 |
|wday| |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
917 |
|
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
918 |
wday := (1 "know, that 1st Jan 1901 was a tuesday" |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
919 |
+ self asDays) \\ 7 + 1. |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
920 |
wday < 1 ifTrue:[ |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
921 |
wday := wday + 7 |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
922 |
]. |
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
923 |
^ wday |
699 | 924 |
|
925 |
" |
|
1501 | 926 |
Date today dayInWeek |
3257 | 927 |
Date today weekday |
1501 | 928 |
(Date day:15 month:4 year:1959) dayInWeek |
929 |
(Date day:1 month:1 year:1901) dayInWeek |
|
3256
637d16a0c83b
care for date before 1.1.1900 in dayInWeek.
Claus Gittinger <cg@exept.de>
parents:
2706
diff
changeset
|
930 |
(Date day:31 month:12 year:1899) dayInWeek |
699 | 931 |
" |
1501 | 932 |
|
3257 | 933 |
"Modified: / 1.2.1998 / 14:10:27 / cg" |
699 | 934 |
! |
935 |
||
936 |
dayName |
|
937 |
"return the week-day of the receiver as a string. |
|
938 |
The returned string depends on the language setting. |
|
939 |
Expect things like 'monday', 'tuesday' ... |
|
940 |
Obsolete: |
|
941 |
use #weekday for ST-80 compatibility" |
|
942 |
||
943 |
^ self weekday |
|
944 |
! |
|
77 | 945 |
|
946 |
dayOfMonth |
|
947 |
"Answer the day of the month represented by me. |
|
948 |
Same as day; for ST-80 compatibility." |
|
949 |
||
950 |
^ self day |
|
92 | 951 |
|
952 |
" |
|
953 |
Date today dayOfMonth |
|
954 |
" |
|
955 |
! |
|
956 |
||
957 |
daysInMonth |
|
958 |
"return the number of days in the month of the receiver" |
|
959 |
||
960 |
^ Date daysInMonth:(self month) forYear:(self year) |
|
961 |
||
962 |
" |
|
963 |
Date today daysInMonth |
|
964 |
" |
|
965 |
! |
|
966 |
||
967 |
daysInYear |
|
968 |
"return the number of days in the year of the receiver" |
|
969 |
||
970 |
^ Date daysInYear:(self year) |
|
971 |
||
972 |
" |
|
973 |
Date today daysInYear |
|
974 |
" |
|
975 |
! |
|
976 |
||
977 |
daysLeftInYear |
|
978 |
"return the number of days left in the year of the receiver" |
|
979 |
||
980 |
^ Date daysInYear:(self year) - self day |
|
981 |
||
982 |
" |
|
983 |
Date today daysLeftInYear |
|
984 |
" |
|
77 | 985 |
! |
986 |
||
699 | 987 |
leap |
988 |
"return true, if the receivers year is a leap year" |
|
68 | 989 |
|
699 | 990 |
^ Date leapYear:(self year) |
68 | 991 |
|
92 | 992 |
" |
699 | 993 |
Date today leap |
994 |
(Date day:1 month:1 year:1992) leap |
|
92 | 995 |
" |
68 | 996 |
! |
997 |
||
699 | 998 |
month |
999 |
"return the month (1..12) of the receiver" |
|
92 | 1000 |
|
699 | 1001 |
^ (dateEncoding // 100) \\ 100 |
68 | 1002 |
|
92 | 1003 |
" |
699 | 1004 |
Date today month |
92 | 1005 |
" |
68 | 1006 |
! |
1007 |
||
77 | 1008 |
monthIndex |
1009 |
"return the index of the month (e.g. Feb.=2). |
|
1010 |
Same as month; for ST-80 compatibility." |
|
1011 |
||
1012 |
^ self month |
|
1013 |
! |
|
1014 |
||
68 | 1015 |
monthName |
1016 |
"return the month of the receiver as a string. |
|
1017 |
The returned string depends on the language setting. |
|
1018 |
Expect things like 'january', 'february' ..." |
|
1019 |
||
1020 |
^ self class nameOfMonth:(self month) |
|
1021 |
||
92 | 1022 |
" |
1023 |
Date today monthName |
|
1024 |
(Date day:15 month:4 year:1959) monthName |
|
1025 |
" |
|
68 | 1026 |
! |
1027 |
||
699 | 1028 |
weekday |
1029 |
"return the week-day of the receiver as a string. |
|
68 | 1030 |
The returned string depends on the language setting. |
699 | 1031 |
Expect things like 'monday', 'tuesday' ... |
1032 |
For ST-80 compatibility" |
|
1033 |
||
1034 |
^ self class nameOfDay:(self dayInWeek) |
|
1035 |
||
1036 |
" |
|
1037 |
Date today weekday |
|
1038 |
(Date day:15 month:4 year:1959) weekday |
|
1039 |
" |
|
1040 |
! |
|
1041 |
||
1042 |
year |
|
1043 |
"return the year (1..12) of the receiver" |
|
1044 |
||
1045 |
^ dateEncoding // (100*100) |
|
68 | 1046 |
|
699 | 1047 |
" |
1048 |
Date today year |
|
1049 |
" |
|
1050 |
! ! |
|
1051 |
||
1052 |
!Date methodsFor:'arithmetic'! |
|
1053 |
||
1054 |
addDays:days |
|
1055 |
"return a new date representing 'days' after the receiver. |
|
1056 |
The argument should be some kind of integer. |
|
1057 |
For ST-80 compatibility." |
|
1058 |
||
1059 |
^ self class fromDays:(self asDays + days) |
|
1060 |
||
1061 |
" |
|
1062 |
Date today addDays:7 |
|
1063 |
" |
|
1064 |
! |
|
1065 |
||
1066 |
daysUntil:aDate |
|
1067 |
"return the number of days between the receiver and the argument, |
|
1068 |
aDate, whuch should be some kind of date" |
|
1069 |
||
1070 |
^ aDate asDays - self asDays |
|
68 | 1071 |
|
92 | 1072 |
" |
699 | 1073 |
(Date day:24 month:12 year:1994) daysUntil:(Date day:1 month:1 year:1995) |
1074 |
(Date day:1 month:2 year:1992) daysUntil:(Date day:1 month:3 year:1992) |
|
1075 |
(Date day:1 month:2 year:1994) daysUntil:(Date day:1 month:3 year:1994) |
|
1076 |
||
1077 |
|delta| |
|
1078 |
delta := Date today |
|
1079 |
daysUntil:(Date day:25 month:12 year:Date today year). |
|
1080 |
Transcript show:'still '; |
|
1081 |
show:delta ; |
|
1422 | 1082 |
showCR:' days till xmas' |
699 | 1083 |
" |
1084 |
! |
|
1085 |
||
1086 |
minusDays:days |
|
1087 |
"return a new date representing 'days' before the receiver. |
|
1088 |
The argument should be some kind of integer. |
|
1089 |
Obsolete: |
|
1090 |
Please dont use this method since it will vanish. |
|
1091 |
Use #subtractDays: instead for ST-80 compatibility." |
|
1092 |
||
1093 |
^ self subtractDays:days |
|
1094 |
! |
|
1095 |
||
1096 |
plusDays:days |
|
1097 |
"return a new date representing 'days' after the receiver. |
|
1098 |
The argument should be some kind of integer. |
|
1099 |
Obsolete: |
|
1100 |
Please dont use this method since it will vanish. |
|
1101 |
Use #addDays: instead for ST-80 compatibility." |
|
1102 |
||
1103 |
^ self addDays:days |
|
1104 |
! |
|
1105 |
||
1106 |
subtractDate:aDate |
|
1107 |
"return the number of days between the receiver and aDate" |
|
1108 |
||
1109 |
^ self asDays - aDate asDays |
|
1110 |
||
1111 |
" |
|
1112 |
(Date day:1 month:1 year:1995) subtractDate:(Date day:24 month:12 year:1994) |
|
1113 |
(Date day:1 month:3 year:1992) subtractDate:(Date day:1 month:2 year:1992) |
|
1114 |
(Date day:1 month:3 year:1994) subtractDate:(Date day:1 month:2 year:1994) |
|
1115 |
" |
|
1116 |
! |
|
1117 |
||
1118 |
subtractDays:days |
|
1119 |
"return a new date representing 'days' before the receiver. |
|
1120 |
The argument should be some kind of integer. |
|
1121 |
For ST-80 compatibility" |
|
1122 |
||
1123 |
^ self class fromDays:(self asDays - days) |
|
1124 |
||
1125 |
" |
|
1126 |
Date today subtractDays:7 |
|
92 | 1127 |
" |
1 | 1128 |
! ! |
1129 |
||
1130 |
!Date methodsFor:'comparing'! |
|
1131 |
||
29 | 1132 |
< aDate |
1133 |
"return true, if the date represented by the receiver |
|
1134 |
is before the argument, aDate" |
|
1135 |
||
54 | 1136 |
(aDate isMemberOf:Date) ifTrue:[ |
155 | 1137 |
^ dateEncoding < aDate dateEncoding |
54 | 1138 |
]. |
29 | 1139 |
|
54 | 1140 |
"the argument must understand year, month and day to be |
1141 |
comparable, whatever it is" |
|
1142 |
||
1143 |
^ dateEncoding < (Date encodeYear:aDate year |
|
155 | 1144 |
month:aDate month |
1145 |
day:aDate day) |
|
68 | 1146 |
|
1147 |
"Date today < (Date day:24 month:12 year:2000)" |
|
1148 |
"Date today < (Date day:24 month:12 year:1900)" |
|
29 | 1149 |
! |
1 | 1150 |
|
1151 |
= aDate |
|
1152 |
"return true, if the date represented by the receiver |
|
1153 |
is the same as the one represented by argument, aDate" |
|
1154 |
||
155 | 1155 |
(aDate isMemberOf:Date) ifFalse:[^ false]. |
1156 |
||
1157 |
^ dateEncoding = aDate dateEncoding |
|
54 | 1158 |
|
1159 |
"the argument must understand year, month and day to be |
|
1160 |
comparable, whatever it is" |
|
1161 |
||
155 | 1162 |
" |
54 | 1163 |
^ dateEncoding = (Date encodeYear:aDate year |
155 | 1164 |
month:aDate month |
1165 |
day:aDate day) |
|
1166 |
" |
|
68 | 1167 |
"Date today = ((Date today plusDays:7) minusDays:7)" |
92 | 1168 |
! |
1169 |
||
699 | 1170 |
> aDate |
1171 |
"return true, if the date represented by the receiver |
|
1172 |
is after the argument, aDate" |
|
1173 |
||
1174 |
(aDate isMemberOf:Date) ifTrue:[ |
|
1175 |
^ dateEncoding > aDate dateEncoding |
|
1176 |
]. |
|
1177 |
||
1178 |
"the argument must understand year, month and day to be |
|
1179 |
comparable, whatever it is" |
|
1180 |
||
1181 |
^ dateEncoding > (Date encodeYear:aDate year |
|
1182 |
month:aDate month |
|
1183 |
day:aDate day) |
|
1184 |
||
1185 |
"Date today > (Date day:24 month:12 year:2000)" |
|
1186 |
"Date today > (Date day:24 month:12 year:1900)" |
|
1187 |
! |
|
1188 |
||
92 | 1189 |
hash |
1190 |
"return an integer useful for hashing on dates" |
|
1191 |
||
1192 |
^ dateEncoding |
|
1 | 1193 |
! ! |
1194 |
||
1501 | 1195 |
!Date methodsFor:'converting'! |
1196 |
||
1197 |
asAbsoluteTime |
|
1198 |
"return an absoluteTime instance, representing midnight of |
|
1199 |
last night" |
|
1200 |
||
4379 | 1201 |
^ AbsoluteTime year:(self year) month:(self month) day:(self day) |
1202 |
hour:0 minute:0 second:0 millisecond:0 |
|
1501 | 1203 |
|
1204 |
" |
|
1205 |
Date today asAbsoluteTime |
|
1206 |
" |
|
1207 |
||
4379 | 1208 |
"Modified: / 1.7.1996 / 14:53:32 / cg" |
1209 |
"Modified: / 13.7.1999 / 12:31:47 / stefan" |
|
4408 | 1210 |
! |
1211 |
||
1212 |
asDate |
|
1213 |
"return the receiver" |
|
1214 |
||
1215 |
^ self |
|
1501 | 1216 |
! ! |
1217 |
||
54 | 1218 |
!Date methodsFor:'printing & storing'! |
1 | 1219 |
|
408 | 1220 |
printFormat:aFormatArray |
1221 |
"return a string containing a printed representation of the receiver. |
|
1222 |
The formatArray argument consists of 6 or 7 integers which control |
|
1223 |
the resulting string. The entries are: |
|
1224 |
1 day position (1, 2 or 3) |
|
1225 |
2 month position (1..3) |
|
1226 |
3 year position (1..3) |
|
1227 |
4 asciiValue of separator character or separator character |
|
4413 | 1228 |
or collection of 2 separator characters |
408 | 1229 |
5 month format (1: numeric; 2: abbreviated name; 3: fullname |
4413 | 1230 |
4: abbreviated uppercase 5: full uppercase) |
408 | 1231 |
6 year format (1 include century; 2 exclude century) |
4413 | 1232 |
7 (optional) true/false. |
1233 |
if true, print numbers in 2-digit format |
|
1234 |
(i.e. with leading zeros); |
|
1235 |
Taken as false, if ommited |
|
408 | 1236 |
|
1237 |
Day and monthnames are in the currently active language. |
|
1238 |
||
1239 |
This method supports more options than the ST-80 version; month formats |
|
1240 |
4 and 5, non-numeric separators and the optional 7th parameter are not |
|
1241 |
supported by ST-80. Be aware of this for compatibility reasons. |
|
1242 |
||
4413 | 1243 |
Notice that not all formats can be scanned (correctly) by #readFrom: |
1244 |
This is an ST-80 compatibility method - I would have choosen another |
|
1245 |
(less cryptic) formatString ... |
|
1246 |
" |
|
408 | 1247 |
|
1248 |
|mf upperCase day month year components sep1 sep2 leadingZeros| |
|
1249 |
||
1250 |
aFormatArray size > 6 ifTrue:[ |
|
4413 | 1251 |
leadingZeros := aFormatArray at:7 |
408 | 1252 |
] ifFalse:[ |
4413 | 1253 |
leadingZeros := false. |
408 | 1254 |
]. |
1255 |
||
1256 |
components := Array new:3. |
|
1257 |
day := self day. |
|
1258 |
leadingZeros ifTrue:[ |
|
4413 | 1259 |
day := day printStringLeftPaddedTo:2 with:$0 |
408 | 1260 |
] ifFalse:[ |
4413 | 1261 |
day := day printString |
408 | 1262 |
]. |
1263 |
components at:(aFormatArray at:1) put:day. |
|
1264 |
||
1265 |
upperCase := false. |
|
1266 |
mf := aFormatArray at:5. |
|
1267 |
(mf between:4 and:5) ifTrue:[mf := mf - 2. upperCase := true]. |
|
1268 |
||
1269 |
mf == 1 ifTrue:[ |
|
4413 | 1270 |
month := self month. |
1271 |
leadingZeros ifTrue:[ |
|
1272 |
month := month printStringLeftPaddedTo:2 with:$0 |
|
1273 |
] ifFalse:[ |
|
1274 |
month := month printString |
|
1275 |
] |
|
408 | 1276 |
] ifFalse:[ |
4413 | 1277 |
mf == 2 ifTrue:[ |
1278 |
month := self abbreviatedMonthName |
|
1279 |
] ifFalse:[ |
|
1280 |
month := self monthName |
|
1281 |
] |
|
408 | 1282 |
]. |
1283 |
upperCase ifTrue:[month := month asUppercase]. |
|
1284 |
components at:(aFormatArray at:2) put:month. |
|
1285 |
||
1286 |
year := self year. |
|
1287 |
(aFormatArray at:6) == 2 ifTrue:[ |
|
4413 | 1288 |
year := year \\ 100 |
408 | 1289 |
]. |
1290 |
components at:(aFormatArray at:3) put:year printString. |
|
1291 |
||
1292 |
sep1 := (aFormatArray at:4). |
|
1293 |
sep1 isCollection ifTrue:[ |
|
4413 | 1294 |
sep2 := (sep1 at:2). |
1295 |
sep1 := (sep1 at:1). |
|
408 | 1296 |
] ifFalse:[ |
4413 | 1297 |
sep1 := sep2 := sep1 asCharacter |
408 | 1298 |
]. |
1299 |
||
1300 |
^ (components at:1) |
|
1301 |
, sep1 asString |
|
1302 |
, (components at:2) |
|
1303 |
, sep2 asString |
|
1304 |
, (components at:3) |
|
1305 |
||
1306 |
" |
|
4413 | 1307 |
Date today printFormat:#(1 2 3 $- 1 2) |
1308 |
Date today printFormat:#(1 2 3 $. 1 2 true) |
|
1309 |
Date today printFormat:#(2 1 3 32 3 1) |
|
408 | 1310 |
Date today printFormat:#(2 1 3 #(' ' ', ') 3 1) |
1311 |
Date today printFormat:#(1 2 3 $- 2 1) |
|
1312 |
Date today printFormat:#(1 2 3 $- 4 1) |
|
1313 |
" |
|
1314 |
! |
|
1315 |
||
1316 |
printFormat:aFormatArray on:aStream |
|
1317 |
"append a printed representation of the receiver to aStream. |
|
1318 |
The argument, aFormatString controls the format, as described |
|
1319 |
in the #printFormat: method. |
|
1320 |
Notice that not all formats can be scanned (correctly) by #readFrom:" |
|
1321 |
||
1322 |
aStream nextPutAll:(self printFormat:aFormatArray) |
|
1323 |
||
1324 |
||
1325 |
"european formats: |
|
1326 |
||
1327 |
Date today printFormat:#(1 2 3 $- 1 2) on:Transcript. Transcript cr. |
|
1328 |
Date today printFormat:#(1 2 3 $- 2 2) on:Transcript. Transcript cr. |
|
1329 |
Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr. |
|
1330 |
Date today printFormat:#(1 2 3 $- 3 2) on:Transcript. Transcript cr. |
|
1331 |
Date today printFormat:#(1 2 3 $. 1 2) on:Transcript. Transcript cr. |
|
1332 |
Date today printFormat:#(1 2 3 $. 1 2 true) on:Transcript. Transcript cr. |
|
1333 |
||
1334 |
US formats: |
|
1335 |
||
1336 |
Date today printFormat:#(2 1 3 32 3 1) on:Transcript. Transcript cr. |
|
1337 |
Date today printFormat:#(2 1 3 32 2 2) on:Transcript. Transcript cr. |
|
1338 |
Date today printFormat:#(2 1 3 $/ 1 2) on:Transcript. Transcript cr. |
|
1339 |
Date today printFormat:#(2 1 3 $- 2 1) on:Transcript. Transcript cr. |
|
1340 |
Date today printFormat:#(2 1 3 #(' ' ', ') 2 1) on:Transcript. Transcript cr. |
|
1341 |
Date today printFormat:#(1 2 3 $- 2 1) on:Transcript. Transcript cr. |
|
1342 |
Date today printFormat:#(1 2 3 $- 4 1) on:Transcript. Transcript cr. |
|
1343 |
" |
|
699 | 1344 |
! |
1345 |
||
1346 |
printOn:aStream |
|
1347 |
"append a printed representation of the receiver to aStream" |
|
1348 |
||
1349 |
self printFormat:#(1 2 3 $- 2 1) on:aStream |
|
1350 |
||
1351 |
" |
|
1352 |
Date today printOn:Transcript |
|
1353 |
Date today printNL |
|
1354 |
" |
|
1355 |
||
1356 |
"Modified: 27.8.1995 / 01:01:49 / claus" |
|
1357 |
! |
|
1358 |
||
1359 |
storeOn:aStream |
|
1360 |
"append a representation to aStream, from which the receiver |
|
1361 |
can be reconstructed" |
|
1362 |
||
1363 |
aStream nextPutAll:'('; nextPutAll:'Date day:'. |
|
1364 |
self day printOn:aStream. |
|
1365 |
aStream nextPutAll:' month:'. |
|
1366 |
self month printOn:aStream. |
|
1367 |
aStream nextPutAll:' year:'. |
|
1368 |
self year printOn:aStream. |
|
1369 |
aStream nextPutAll:')' |
|
1370 |
||
1371 |
" |
|
1372 |
Date today storeOn:Transcript |
|
1373 |
Date today storeString |
|
1374 |
" |
|
1 | 1375 |
! ! |
699 | 1376 |
|
1377 |
!Date methodsFor:'private accessing'! |
|
1378 |
||
1379 |
dateEncoding |
|
1380 |
"the internal encoding is stricktly private, |
|
1381 |
and should not be used outside." |
|
1382 |
||
1383 |
^ dateEncoding |
|
1384 |
! |
|
1385 |
||
1386 |
dateEncoding:anInteger |
|
1387 |
"the internal encoding is stricktly private, |
|
1388 |
and should not be used outside." |
|
1389 |
||
1390 |
dateEncoding := anInteger |
|
1391 |
! |
|
1392 |
||
1393 |
fromOSTime:osTime |
|
1394 |
"set my dateEncoding from an OS time. |
|
1395 |
This somewhat clumsy implementation hides the OS's date representation |
|
1396 |
(i.e. makes this class independent of what the OS starts its time values with). |
|
1397 |
Dont use this method, the osTime representation is totally unportable." |
|
1398 |
||
1399 |
OperatingSystem computeDatePartsOf:osTime |
|
1501 | 1400 |
for:[:year :month :day | |
1401 |
dateEncoding := (((year * 100) + month) * 100) + day |
|
699 | 1402 |
] |
1501 | 1403 |
|
1404 |
"Modified: 1.7.1996 / 15:23:12 / cg" |
|
699 | 1405 |
! ! |
1406 |
||
2706
878723bc99fc
added #shortPrintString for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1701
diff
changeset
|
1407 |
!Date class methodsFor:'documentation'! |
699 | 1408 |
|
1409 |
version |
|
4998 | 1410 |
^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.49 1999-11-16 16:00:44 stefan Exp $' |
699 | 1411 |
! ! |
1412 |
Date initialize! |