--- a/AbstractTime.st Fri May 25 09:44:00 2018 +0200
+++ b/AbstractTime.st Fri May 25 12:17:48 2018 +0200
@@ -1490,6 +1490,9 @@
|time hours minutes seconds millis micros nanos picos
millisZ3 picosZ9 fract012 fract s t|
+ aDictionary at:#'iso8601' put:[ self printStringIso8601 ].
+ aDictionary at:#'iso8601_compact' put:[ self printStringIso8601Compressed ].
+
time := self asTime.
hours := time hours.
minutes := time minutes.
@@ -1568,7 +1571,7 @@
(TimeDuration fromNanoseconds:30) printStringFormat:'%(microF4)us'
"
- "Modified (comment): / 23-05-2018 / 10:49:35 / Claus Gittinger"
+ "Modified: / 25-05-2018 / 12:16:05 / Claus Gittinger"
!
addPrintBindingsTo:aDictionary
@@ -1711,6 +1714,22 @@
"
!
+printIso8601CompressedOn:aStream
+ self subclassResponsibility
+
+ "
+ Timestamp now printStringIso8601 -> '2018-05-09T12:15:53.279'
+ Time now printStringIso8601 -> 'T16:27:08'
+ Date today printStringIso8601 -> '2018-05-09'
+
+ Timestamp now printStringIso8601Compressed -> '20180525T120822.699'
+ Time now printStringIso8601Compressed -> 'T120837'
+ Date today printStringIso8601Compressed -> '20180525'
+ "
+
+ "Created: / 25-05-2018 / 12:08:07 / Claus Gittinger"
+!
+
printIso8601FormatOn:aStream
self subclassResponsibility
@@ -1843,8 +1862,27 @@
^ String streamContents:[:s | self printIso8601FormatOn:s]
"
- Timestamp now printStringIso8601Format
+ Timestamp now printStringIso8601
"
+
+ "Modified (comment): / 25-05-2018 / 11:58:37 / Claus Gittinger"
+!
+
+printStringIso8601Compressed
+ "return the Iso8601 representation of the receiver with local timezon information.
+ This format looks like:
+ 1999-01-01T24:00:00
+ or, for zero hr:min:sec,
+ 1999-01-01
+ Of course, a 24 hour clock is used."
+
+ ^ String streamContents:[:s | self printIso8601CompressedOn:s]
+
+ "
+ Timestamp now printStringIso8601Compressed
+ "
+
+ "Created: / 25-05-2018 / 11:58:29 / Claus Gittinger"
!
printStringIso8601Format