-
Notifications
You must be signed in to change notification settings - Fork 1
/
Time.st
34 lines (27 loc) · 878 Bytes
/
Time.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Time extend [
<category: 'IyziForum'>
<comment: nil>
printFormatted: aFormat language: aLanguage [
| hour minute second formattedString |
<category: 'printing'>
(self hour printString size = 1)
ifTrue: [
hour := '0', self hour printString]
ifFalse: [
hour := self hour printString].
(self minute printString size = 1)
ifTrue: [
minute := '0', self minute printString]
ifFalse: [
minute := self minute printString].
(self second printString size = 1)
ifTrue: [
second := '0', self second printString]
ifFalse: [
second := self second printString].
formattedString := aFormat copyReplacingAllRegex: 'HH' with: hour.
formattedString := formattedString copyReplacingAllRegex: 'MM' with: minute.
formattedString := formattedString copyReplacingAllRegex: 'SS' with: second.
^formattedString
]
]