21 lines
452 B
Go
21 lines
452 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
func FirstDayOfMonth() string {
|
|
// Load America/Detroit timezone
|
|
loc, err := time.LoadLocation("America/Detroit")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Get current time in Detroit timezone
|
|
now := time.Now().In(loc)
|
|
|
|
// Create midnight of the first day of the current month
|
|
firstDay := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, loc)
|
|
|
|
// Return ISO8601 formatted string
|
|
return firstDay.Format(time.RFC3339)
|
|
}
|