--- a/Date.st Wed Jul 21 12:04:13 1999 +0200
+++ b/Date.st Wed Jul 21 16:51:43 1999 +0200
@@ -244,6 +244,43 @@
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']
+ "
+
+ "Created: 16.11.1995 / 22:50:17 / cg"
+ "Modified: 8.10.1996 / 19:25:39 / cg"
+!
+
+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:.
+ BUG:
+ This method assumes american format (i.e. month-day-year) instead
+ of the german/french and other day-month-year.
+ There ought to be a nationalized variant of this."
+
+ |newDate|
+
+ ErrorSignal handle:[:ex |
+ ^ exceptionBlock value
+ ] do:[
+ |str month day year|
+
+ str := aStringOrStream readStream.
+ month := str next:2.
+ month := Integer readFrom:month.
+ day := str next:2.
+ day := Integer readFrom:day.
+ year := str next:4.
+ year := Integer readFrom:year.
+
+ newDate := self newDay:day month:month year:year
+ ].
+ ^ newDate
+
+ "
+ Date readMMDDYYYYFrom:'10041999' onError:['wrong date']
"
"Created: 16.11.1995 / 22:50:17 / cg"
@@ -1299,6 +1336,6 @@
!Date class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.45 1999-07-19 19:26:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.46 1999-07-21 14:51:43 cg Exp $'
! !
Date initialize!