Date.st
changeset 10912 37bf6915a0e9
parent 10908 88b75a3ed4eb
child 11079 cd8abd9e87a7
--- a/Date.st	Mon Mar 10 10:26:03 2008 +0100
+++ b/Date.st	Tue Mar 11 18:11:10 2008 +0100
@@ -577,6 +577,30 @@
     "Modified: 8.10.1996 / 19:25:39 / cg"
 !
 
+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:"
+
+    ^ [
+        |str month day year|
+
+        str := aStringOrStream readStream.
+        year := str next:4.
+        year := Integer readFrom:year.
+        month := str next:2.
+        month := Integer readFrom:month.
+        day := str next:2.
+        day := Integer readFrom:day.
+
+        self newDay:day month:month year:year
+    ] on:Error do:exceptionBlock
+
+    "
+     Date readYYYYMMDDFrom:'19991004' onError:['wrong date']  
+    "
+!
+
 today
     "return a date, representing today.
      See also: Time now / Timestamp now."
@@ -2513,7 +2537,7 @@
 !Date class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.104 2008-03-09 22:13:46 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.105 2008-03-11 17:11:10 cg Exp $'
 ! !
 
 Date initialize!