Being able to parse these timestamps correctly and produce correct Unix 
time from them;

Together with the Gophers slack, we found this ugly, but working hack: 
https://go.dev/play/p/nG-M0pUrm0Z
stamp, _ := time.Parse(layout, v)
loc, _ := time.LoadLocation(stamp.Location().String())
stamp, _ = time.ParseInLocation(layout, v, loc)

glibc is doing this better IMHO.

On Thursday, February 9, 2023 at 8:47:52 PM UTC+1 Ian Lance Taylor wrote:

> On Thu, Feb 9, 2023 at 11:26 AM 'Thomas Casteleyn' via golang-nuts
> <golan...@googlegroups.com> wrote:
> >
> > Hi, I originally asked on Gophers slack where they directed me to this 
> group.
> >
> > It seems I'm not able to parse these 2 timestamps with timezone 
> correctly: https://go.dev/play/p/VZwD29701ps
> >
> > The responses show confusing time formats and the playground even seems 
> to be more wrong than on my local machine.
> >
> > How should I correctly parse both timestamps in Go?
>
> It's not clear to me what you are actually trying to do.
> ParseInLocation will look for a timezone name like CET or MST relative
> to the location that you give it. This approach is used because
> identifiers like CET or MST are ambiguous. So in general it's odd to
> use ParseInLocation with an arbitrary timezone identifier. What is
> your actual goal?
>
> Ian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6b3b1802-11ea-4bc8-bf04-805691cd9d4an%40googlegroups.com.

Reply via email to