|
@@ -454,3 +454,21 @@ func GetBeginAndEndTime1(period string) (string, string) {
|
|
|
end := thisMonth.AddDate(0, 1, -1).Format("2006-1-2")
|
|
|
return start, end
|
|
|
}
|
|
|
+
|
|
|
+// 根据时间戳获取 月初 月末 0代表本月
|
|
|
+func GetMonthBeginTimeAndEndTime(num int64) (string, string) {
|
|
|
+ if num == 0 {
|
|
|
+ num = time.Now().Unix()
|
|
|
+ }
|
|
|
+ tm := time.Unix(num, 0)
|
|
|
+ currentYear, currentMonth, _ := tm.Date()
|
|
|
+ currentLocation := tm.Location()
|
|
|
+ firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
|
|
|
+ lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
|
|
|
+ return firstOfMonth.Format("2006-01-02"), lastOfMonth.Format("2006-01-02")
|
|
|
+}
|
|
|
+
|
|
|
+// 获取当前账期
|
|
|
+func GetThisYearMonth() string {
|
|
|
+ return time.Now().Format("2006-01")
|
|
|
+}
|