Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: support for parsing variable time zones #25570

Closed
subtlepseudonym opened this issue May 25, 2018 · 4 comments
Closed

time: support for parsing variable time zones #25570

subtlepseudonym opened this issue May 25, 2018 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@subtlepseudonym
Copy link

I'm running go1.10 darwin/amd64

What did you do?

I attempted to parse "0800 EST5EDT" using a custom time format "1500 MST7MDT" and only the "EST" portion of the variable timezone was recognized by time.Parse().

What did you expect to see?

A correctly parsed *time.Time type with no errors returned.

What did you see instead?

An error was returned stating that the "5EDT" portion of the variable timezone didn't match the format's "7MDT".

https://play.golang.org/p/hF01Thqr3p6

@andybons andybons changed the title feature request: support for parsing variable time zones time: support for parsing variable time zones May 25, 2018
@andybons
Copy link
Member

Can you give a bit more background on the problem you're trying to solve with a custom time format like that? Thank you.

@andybons andybons added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 25, 2018
@andybons andybons added this to the Unplanned milestone May 25, 2018
@subtlepseudonym
Copy link
Author

I'm scheduling jobs that reoccur daily, but depend upon when the day starts and ends in that timezone. So, I need both time of day and timezone info for each job. The above format would be convenient by allowing me to store both pieces of information succinctly.

@agnivade
Copy link
Contributor

Thanks for the update @subtlepseudonym. I looked into it and it seems that the general recommendation is to use country based timezone names for situations like these. For eg. "America/New_York" is the same as "EST5EDT".

With that, you can load a location and use the In method to get the time in a location. Does that work for you ? I think it's a decent solution which uses the existing tools we have at hand, without adding additional complexity.

@agnivade agnivade added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 13, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants