TiddlyWikiPharo/repository/TiddlyWiki/DateAndTime.extension.st

29 lines
713 B
Smalltalk
Raw Normal View History

2024-05-30 17:44:20 +00:00
Extension { #name : #DateAndTime }
{ #category : #'*TiddlyWiki' }
DateAndTime >> asTiddlerFormat [
| hours minutes secondsTemp |
hours := self hours.
minutes := self minutes.
secondsTemp := self seconds.
^ (self dayMonthYearDo: [ :d :m :y |
y asString,
(m < 10
ifTrue: [ '0', m asString ]
ifFalse: [ m asString]),
(d < 10
ifTrue: [ '0', d asString ]
ifFalse: [ d asString])]),
(hours < 10
ifTrue: [ '0',hours asString ]
ifFalse: [ hours asString]),
(minutes < 10
ifTrue: [ '0', minutes asString ]
ifFalse: [ minutes asString]),
(secondsTemp < 10
ifTrue: [ '0', secondsTemp asString ]
ifFalse: [ secondsTemp asString]),
(self nanoSecond asString copyFrom: 1 to: 3)
]