[Glass] understanding the DateTime instance creation API
Dale Henrichs via Glass
glass at lists.gemtalksystems.com
Fri Jul 15 15:20:21 PDT 2016
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
More information about the Glass
mailing list