Login  Register

Re: understanding the DateTime instance creation API

Posted by GLASS mailing list on Jul 15, 2016; 9:37pm
URL: https://forum.world.st/understanding-the-DateTime-instance-creation-API-tp4906741p4906755.html

Thanks Paul, I've added this to the bug report ...

Dale

On 07/15/2016 02:15 PM, Paul DeBruicker via Glass wrote:

> DateTime>>#asStringISO8601
>    "yyyy-mm-ddThh:mm:ss+zzzz"
>
>    | string offset offsetHours offsetMinutes |
>    string := self
>      asStringUsingFormat: #(3 2 1 $- 1 1 $: true true false true true).
>    string at: 11 put: $T.
>    string := string first: 19.
>    offset := timeZone offsetAtLocal: self.
>    string
>      add:
>        (offset < 0
>          ifTrue: [ $- ]
>          ifFalse: [ $+ ]).
>    offset := offset abs // 60.
>    offsetHours := offset // 60.
>    offsetMinutes := offset \\ 60.
>    offsetHours < 10
>      ifTrue: [ string add: $0 ].
>    string addAll: offsetHours printString.
>    offsetMinutes < 10
>      ifTrue: [ string add: $0 ].
>    string addAll: offsetMinutes printString.
>    ^ string

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass