Closed ETLJ closed 1 year ago
@ETLJ
Hi,you may could try using time.LoadLocation
and time.ParseInLocation
.
Below code is my new project:
toBeCharge := "2023-07-26T15:22:52Z"
timeLayout := "2006-01-02T15:04:05Z"
loc, _ := time.LoadLocation("Local")
theTime, _ := time.ParseInLocation(timeLayout, toBeCharge, loc)
fmt.Println("oracle date convert to str1", theTime.Format("2006-01-02 15:04:05"))
timeStr := "15-JUN-23 10.57.44 PM"
timeTemplate := "02-Jan-06 03.04.05 PM"
local, _ := time.LoadLocation("Local")
yourTime, _ := time.ParseInLocation(timeTemplate, timeStr, local)
fmt.Println("oracle date convert to str2", yourTime.Format("2006-01-02 15:04:05"))
It appears that values in my table of type DATE are getting mapped to a UTC time in my program, but I am new to the project and I'm probably just doing something wrong.
I have values in my table that are of type DATE, and in SqlDeveloper I see that my sessiontimezone is America/New_York:
But when I run that same query in my Go program, I see
The sessiontimezone looks correct at -04:00 for America/New_York, but the created date is UTC.
Is there something I need to do in order to get the DATE mapped over to my timezone? I'm happy to provide more details just let me know. Thanks!