-
Notifications
You must be signed in to change notification settings - Fork 23
/
time_references.go
52 lines (40 loc) · 993 Bytes
/
time_references.go
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
49
50
51
52
package AuthorizeCIM
import "time"
func Now() time.Time {
current_time := time.Now().UTC()
return current_time
}
func LastWeek() time.Time {
t := time.Now().UTC().AddDate(0, 0, -1)
return t
}
func LastMonth() time.Time {
t := time.Now().UTC().AddDate(0, -1, 0)
return t
}
func LastYear() time.Time {
t := time.Now().UTC().AddDate(-1, 0, 0)
return t
}
func CurrentDate() string {
current_time := time.Now().UTC()
return current_time.Format("2006-01-02")
}
func IntervalMonthly() Interval {
return Interval{Length: "1", Unit: "months"}
}
func IntervalQuarterly() Interval {
return Interval{Length: "3", Unit: "months"}
}
func IntervalWeekly() Interval {
return Interval{Length: "7", Unit: "days"}
}
func IntervalDays(amount string) Interval {
return Interval{Length: amount, Unit: "days"}
}
func IntervalMonths(amount string) Interval {
return Interval{Length: amount, Unit: "months"}
}
func IntervalYearly() Interval {
return Interval{Length: "365", Unit: "days"}
}