AbstractTime.st
changeset 22826 ec2526db594c
parent 22632 df853ecc851b
child 22836 1c878b36a068
--- a/AbstractTime.st	Wed May 09 12:09:06 2018 +0200
+++ b/AbstractTime.st	Wed May 09 12:19:54 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
               All Rights Reserved
@@ -1170,7 +1172,6 @@
     "/ ^ aTimestamp getSeconds - self getSeconds
 ! !
 
-
 !AbstractTime methodsFor:'printing & storing'!
 
 addBasicPrintBindingsTo:aDictionary language:languageOrNil
@@ -1470,6 +1471,16 @@
     "
 !
 
+printIso8601FormatOn:aStream
+    self subclassResponsibility
+
+    "
+     Timestamp now printStringIso8601Format -> '2018-05-09T12:15:53.279+02'
+     Time now printStringIso8601Format
+     Date today printStringIso8601Format
+    "
+!
+
 printOn:aStream format:aFormatString
     "print using a format string;
      See #addPrintBindingsTo:language: for allowed format strings"
@@ -1579,6 +1590,21 @@
     "
 
     "Modified: 22.2.1996 / 16:58:30 / cg"
+!
+
+printStringIso8601Format
+    "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 printIso8601FormatOn:s]
+
+    "
+     Timestamp now printStringIso8601Format
+    "
 ! !
 
 !AbstractTime methodsFor:'private'!