Date readFrom format

Ragnar Hojland Espinosa ragnar at linalco.com
Mon Aug 26 18:09:25 UTC 2002


I noticed Date>>readFrom doesn't take a date in ISO 8601 (YYYY-MM-DD)
format.. here's an ugly fix in case anyone finds it useful.

| day month |
aStream peek isDigit ifTrue: [
	day _ Integer readFrom: aStream.
	(day > 1900) ifTrue: [
	     aStream skip: 1.
             month _ Integer readFrom: aStream.
	     aStream skip: 1.

             ^self newDay: (Integer readFrom: aStream) month: month year: day.
        ]
].

-- 
____/|  Ragnar Højland      Freedom - Linux - OpenGL |    Brainbench MVP
\ o.O|  PGP94C4B2F0D27DE025BE2302C104B78C56 B72F0822 | for Unix Programming
 =(_)=  "Thou shalt not follow the NULL pointer for  | (www.brainbench.com)
   U     chaos and madness await thee at its end."             CCNA



More information about the Squeak-dev mailing list