Commit 2c237577d349dea55b20fab5275e82438839b5a6
1 parent
a7bf420dd5
Exists in
master
fixed int formating bug
Showing
3 changed files
with
26 additions
and
1 deletions
Show diff stats
date_util.go
... | ... | @@ -68,3 +68,18 @@ func DaysInMonth(year, month int64) int64 { |
68 | 68 | func IsLeapYear(year int64) bool { |
69 | 69 | return year%4 == 0 && !((year%100 == 0) && (year%400 != 0)) |
70 | 70 | } |
71 | + | |
72 | +// FirstDayOfNextMonthEpoch ... | |
73 | +func FirstDayOfNextMonthEpoch(e int64) int64 { | |
74 | + d, m, y := EpochToDayMonthYear(e) | |
75 | + m++ | |
76 | + if m > 12 { | |
77 | + m = 1 | |
78 | + y++ | |
79 | + } | |
80 | + d = 1 | |
81 | + | |
82 | + date := fmt.Sprintf("%02d/%02d/%d", d, m, y) | |
83 | + | |
84 | + return DateToEpoch(date, DDMMYYYY_sl) | |
85 | +} | ... | ... |
document/document.go
... | ... | @@ -205,6 +205,15 @@ func DeleteFile(path string) error { |
205 | 205 | return os.Remove(path) |
206 | 206 | } |
207 | 207 | |
208 | +func DeleteDocuments(docs []*Document) error { | |
209 | + for _, d := range docs { | |
210 | + if err := d.DeleteFile(); err != nil { | |
211 | + return err | |
212 | + } | |
213 | + } | |
214 | + return nil | |
215 | +} | |
216 | + | |
208 | 217 | // DeleteFile ... |
209 | 218 | func (d *Document) DeleteFile() error { |
210 | 219 | return os.Remove(d.Path) | ... | ... |
int_util.go
... | ... | @@ -72,7 +72,8 @@ func FormatInt64Number(i int64) string { |
72 | 72 | for i >= 1000 { |
73 | 73 | rem := i % 1000 |
74 | 74 | i = i / 1000 |
75 | - res = res + fmt.Sprintf(".%03d", rem) | |
75 | + //res = res + fmt.Sprintf(".%03d", rem) | |
76 | + res = fmt.Sprintf(".%03d", rem) + res | |
76 | 77 | } |
77 | 78 | res = fmt.Sprintf("%d", i) + res |
78 | 79 | return res | ... | ... |