|
@@ -302,6 +302,9 @@ func GetFirstAndLastDayOfPeriod(period string) (string, string) {
|
|
return firstDay.Format("2006-01-02"), lastDay.Format("2006-01-02")
|
|
return firstDay.Format("2006-01-02"), lastDay.Format("2006-01-02")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// RFC3339 = "2006-01-02T15:04:05Z07:00"
|
|
|
|
+const TimeFormat = "2006-01-02 15:04:05"
|
|
|
|
+
|
|
// DateFormatter 将YYYYMMDD格式改为YYYY-MM-DD格式
|
|
// DateFormatter 将YYYYMMDD格式改为YYYY-MM-DD格式
|
|
func DateFormatter(date string) string {
|
|
func DateFormatter(date string) string {
|
|
if len(date) != 8 {
|
|
if len(date) != 8 {
|
|
@@ -440,3 +443,14 @@ func GetCurrentDate1() string {
|
|
period := firstOfMonth.AddDate(0, 0, 0).Format("2006-01") // 当前日期
|
|
period := firstOfMonth.AddDate(0, 0, 0).Format("2006-01") // 当前日期
|
|
return period
|
|
return period
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 获取本月开始和结束的时间
|
|
|
|
+func GetBeginAndEndTime1(period string) (string, string) {
|
|
|
|
+ loc, _ := time.LoadLocation("Local")
|
|
|
|
+ the_time, _ := time.ParseInLocation("200601", period, loc)
|
|
|
|
+ year, month, _ := the_time.Date()
|
|
|
|
+ thisMonth := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
|
|
|
|
+ start := thisMonth.AddDate(0, 0, 0).Format("2006-1-2")
|
|
|
|
+ end := thisMonth.AddDate(0, 1, -1).Format("2006-1-2")
|
|
|
|
+ return start, end
|
|
|
|
+}
|