-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.go
More file actions
48 lines (37 loc) 路 697 Bytes
/
Copy pathutil.go
File metadata and controls
48 lines (37 loc) 路 697 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"encoding/binary"
"strconv"
"time"
)
func Check(e error) {
if e != nil {
panic(e)
}
}
func Itob(v int) []byte {
b := make([]byte, 8)
binary.BigEndian.PutUint64(b, uint64(v))
return b
}
func CurrentWeekAsInt() int {
_, week := time.Now().ISOWeek()
return week
}
func CurrentWeekAsString() string {
s := strconv.Itoa(CurrentWeekAsInt())
return s
}
func CurrentMonth() string {
now := time.Now()
return now.Month().String()
}
func CurrentYear() string {
now := time.Now()
return strconv.Itoa(now.Year())
}
func MonthAndYear() string {
now := time.Now()
monthAndYear := now.Month().String() + ", " + strconv.Itoa(now.Year())
return monthAndYear
}