Created
June 3, 2020 22:52
-
-
Save michimani/c30ea6bbaa672f4f8b4f08d61d98d0a6 to your computer and use it in GitHub Desktop.
Revisions
-
Yoshihiro Ito created this gist
Jun 3, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ package main import ( "context" "time" ) // IsFirstDay is function to check today is the 1st day of month in JST func IsFirstDay() bool { var isFirstDay bool = false nowUTC := time.Now() jst := time.FixedZone("Asia/Tokyo", 9*60*60) nowJST := nowUTC.In(jst) if nowJST.Day() == 1 { isFirstDay = true } return isFirstDay } // Handler is function of Lambda handler func Handler(ctx context.Context, event InvokeEvent) (string, error) { isFirstDay := IsFirstDay() if isFirstDay == false { var message string = "Today is not 1st." return message, nil } // any process } func main() { lambda.Start(Handler) }