Last active
November 18, 2016 16:47
-
-
Save cakesmith/57af51c332876e2968fdef6332f5e337 to your computer and use it in GitHub Desktop.
This file contains 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
loc, _ := time.LoadLocation("America/New_York") | |
longForm := "January 02 2006 03:04 pm" | |
year, month, day := time.Now().Date() | |
todayAt, err := time.ParseInLocation(longForm, fmt.Sprintf("%v %v %v %v", month, day, year, timeInput), loc) | |
if err != nil { | |
fmt.Printf("Error parsing time: %s\n", err.Error()) | |
s.User.SendString(fmt.Sprintf(timeTroubleF, timeInput)) | |
return | |
} | |
inThePast := todayAt.Before(inEst(time.Now())) | |
oneHourAgo := time.Now().Add(-1*time.Hour).In(loc).Format("03:04 PM") | |
oneHourFromNow := time.Now().Add(1*time.Hour).In(loc).Format("03:04 PM") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment