Skip to content

Commit

Permalink
feat:得到GMT格式的时间
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyIsMe committed Mar 28, 2023
1 parent 607c9bd commit 721807f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func QueryBeforeTime(num int, flag string) string {
currentTime := time.Now()
deal := "-"
var m time.Duration
if flag == HourTime {
if flag == MinuteTime {
m, _ = time.ParseDuration(deal + strconv.Itoa(num) + "m")
} else if flag == MinuteTime {
} else if flag == HourTime {
m, _ = time.ParseDuration(deal + strconv.Itoa(num) + "h")
} else if flag == SecondTime {
m, _ = time.ParseDuration(deal + strconv.Itoa(num) + "s")
Expand Down Expand Up @@ -378,3 +378,9 @@ func FormatTime(unformatTime string) string {
}
return formatTime
}

// GenGMTTime 得到GMT格式的时间
func GenGMTTime(unformatTime string) string {
formatTimestamp, _ := time.Parse(Complete, FormatTime(unformatTime))
return formatTimestamp.Format("Mon, 02 Jan 2006 15:04:05")
}

0 comments on commit 721807f

Please sign in to comment.