Created
December 8, 2014 08:19
-
-
Save tmlbl/a9d8aed11fc6f3ff0ce6 to your computer and use it in GitHub Desktop.
How to get time in past in Golang https://play.golang.org/p/ROTLEXldq4
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 main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
now := time.Now() | |
oneMonthAgo := time.Unix(now.Unix() - (60 * 60 * 24 * 30), 0) | |
fmt.Println(now) | |
fmt.Println(oneMonthAgo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment