equal
deleted
inserted
replaced
472 |
472 |
473 "Created: 16.11.1995 / 22:50:17 / cg" |
473 "Created: 16.11.1995 / 22:50:17 / cg" |
474 "Modified: 8.10.1996 / 19:25:39 / cg" |
474 "Modified: 8.10.1996 / 19:25:39 / cg" |
475 ! |
475 ! |
476 |
476 |
477 readFrom:aStringOrStream printFormat:aSqueakFormatArrayOrFormatString language:languageOrNil onError:exceptionBlock |
477 readFrom:aStringOrStream printFormat:aFormatStringOrSqueakFormatArray language:languageOrNil onError:exceptionBlock |
478 "return a new Date, reading a printed representation from aStream. |
478 "return a new Date, reading a printed representation from aStream. |
479 aSqueakFormatArrayOrFormatString may either be a squeak formatArray |
479 aFormatStringOrSqueakFormatArray may either be a squeak formatArray |
480 1 day position (1, 2 or 3) |
480 1 day position (1, 2 or 3) |
481 2 month position (1..3) |
481 2 month position (1..3) |
482 3 year position (1..3) |
482 3 year position (1..3) |
483 or a formatString (see printing instance protocol). |
483 or a formatString (see printing instance protocol). |
484 For now %d, %m, %monthName, %shortMonthName and %y are supported in the formatString. |
484 For now %d, %m, %monthName, %shortMonthName and %y are supported in the formatString. |
490 |
490 |
491 |str day month year somePartAssoc| |
491 |str day month year somePartAssoc| |
492 |
492 |
493 str := aStringOrStream readStream. |
493 str := aStringOrStream readStream. |
494 |
494 |
495 aSqueakFormatArrayOrFormatString isArray |
495 aFormatStringOrSqueakFormatArray isArray |
496 ifTrue:[ |
496 ifTrue:[ |
497 [ |
497 [ |
498 |arg| |
498 |arg| |
499 |
499 |
500 arg := Array new:3. |
500 arg := Array new:3. |
504 |
504 |
505 v := (str peek isDigit) ifTrue:[Integer readFrom:str] |
505 v := (str peek isDigit) ifTrue:[Integer readFrom:str] |
506 ifFalse:[str nextAlphaNumericWord]. |
506 ifFalse:[str nextAlphaNumericWord]. |
507 arg at:i put:v |
507 arg at:i put:v |
508 ]. |
508 ]. |
509 year := arg at:(aSqueakFormatArrayOrFormatString at:3). |
509 year := arg at:(aFormatStringOrSqueakFormatArray at:3). |
510 day := arg at:(aSqueakFormatArrayOrFormatString at:1). |
510 day := arg at:(aFormatStringOrSqueakFormatArray at:1). |
511 month := arg at:(aSqueakFormatArrayOrFormatString at:2). |
511 month := arg at:(aFormatStringOrSqueakFormatArray at:2). |
512 ] on:Error do:[:ex| ^ exceptionBlock value]. |
512 ] on:Error do:[:ex| ^ exceptionBlock value]. |
513 ] ifFalse:[ |
513 ] ifFalse:[ |
514 [ |
514 [ |
515 |formatStream fc c sel| |
515 |formatStream fc c sel| |
516 |
516 |
517 formatStream := aSqueakFormatArrayOrFormatString readStream. |
517 formatStream := aFormatStringOrSqueakFormatArray readStream. |
518 |
518 |
519 [formatStream atEnd] whileFalse:[ |
519 [formatStream atEnd] whileFalse:[ |
520 fc := formatStream next. |
520 fc := formatStream next. |
521 fc == $% ifTrue:[ |
521 fc == $% ifTrue:[ |
522 sel := ''. |
522 sel := ''. |
3170 ! ! |
3170 ! ! |
3171 |
3171 |
3172 !Date class methodsFor:'documentation'! |
3172 !Date class methodsFor:'documentation'! |
3173 |
3173 |
3174 version |
3174 version |
3175 ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.149 2014-09-12 14:41:27 stefan Exp $' |
3175 ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.150 2014-09-12 14:44:33 stefan Exp $' |
3176 ! |
3176 ! |
3177 |
3177 |
3178 version_CVS |
3178 version_CVS |
3179 ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.149 2014-09-12 14:41:27 stefan Exp $' |
3179 ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.150 2014-09-12 14:44:33 stefan Exp $' |
3180 ! ! |
3180 ! ! |
3181 |
3181 |
3182 |
3182 |
3183 Date initialize! |
3183 Date initialize! |