TiddlyWikiPharo/repository/TiddlyWiki/String.extension.st

23 lines
618 B
Smalltalk
Raw Permalink Normal View History

2024-05-30 17:44:20 +00:00
Extension { #name : #String }
{ #category : #'*TiddlyWiki' }
String >> asDateAndTimeForTiddler [
| date |
date := OrderedCollection new.
1 to: 4 do: [ :i | date add: (self at: i) ].
date add: '-'.
5 to: 6 do: [ :i | date add: (self at: i) ].
date add: '-'.
7 to: 8 do: [ :i | date add: (self at: i) ].
date add: 'T'.
9 to: 10 do: [ :i | date add: (self at: i) ].
date add: ':'.
11 to: 12 do: [ :i | date add: (self at: i) ].
date add: ':'.
13 to: 14 do: [ :i | date add: (self at: i) ].
date add: '.'.
15 to: 17 do: [ :i | date add: (self at: i) ].
^ ((date joinUsing: ''), '+00:00') asDateAndTime
]