package main
import (
"fmt"
"time"
"github.com/uniplaces/carbon"
)
func main() {
tokyo := "Asia/Tokyo"
// Parse date time from string
startAt, _ := time.Parse("2006-01-02T15:04:05Z", "2019-10-07T06:54:08Z")
endAt, _ := time.Parse("2006-01-02T15:04:05Z", "2019-10-07T06:54:08Z")
// UTC to JST
location, _ := time.LoadLocation("Asia/Tokyo")
startAt = startAt.In(location)
endAt = endAt.In(location)
fmt.Println(startAt, endAt)
// Convert to date range
start, _ := carbon.CreateFromDate(startAt.Year(), startAt.Month(), startAt.Day(), tokyo)
end, _ := carbon.CreateFromDate(endAt.Year(), endAt.Month(), endAt.Day(), tokyo)
fmt.Println(start.StartOfDay(), end.AddDay().StartOfDay())
// Convert to UTC date range
fmt.Println(start.StartOfDay().In(time.UTC).String(), end.EndOfDay().In(time.UTC).String())
}