Last active
December 29, 2016 02:13
-
-
Save alwqx/89bcb6959966e22882fd0cfb904704f0 to your computer and use it in GitHub Desktop.
用Golang计算某时刻前n秒的时间
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import( | |
"fmt" | |
"time" | |
) | |
func SubIntervalTime(interval int64) string { | |
t0 := time.Now() | |
fmt.Println("t0:", t0.Format("2006-01-02 15:04:05")) | |
delta := t0.Unix() - interval | |
fmt.Println("interval:", interval) | |
t := time.Unix(delta, 0) | |
fmt.Println(t.Format("2006-01-02 15:04:05")) | |
return "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment