github.com/blend/go-sdk@v1.20220411.3/timeutil/beginning_of_month.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package timeutil 9 10 import "time" 11 12 // BeginningOfMonth returns the date that represents 13 // the last day of the month for a given time. 14 func BeginningOfMonth(t time.Time) time.Time { 15 return time.Date(t.Year(), t.Month(), 01, 00, 00, 00, 00, t.Location()) // move to YY-MM-01 00:00.00 16 }