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

net/http: why isn't there any mentioning about the need for usage of UTC with http.TimeFormat?? #14103

Closed
elico opened this issue Jan 26, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@elico
Copy link

commented Jan 26, 2016

I was trying to use the http.TimeFormat to format a http response and the way I found to do that is using:
time.Now().UTC().Format(http.TimeFormat)
which uses the format ...
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"

But it's just using the format to output a string with a GMT in it.
I have seen that everywhere in the golang code it's being used with a UTC() time conversion and I think that it is worth to mention that it uses the local time but just adds a GMT to it unless the time is being converted to UTC using the UTC() function.
I encountered this issue more then once in the last couple month and I have not found anything actually mentioning it that you need to use UTC() with it in the docs.(which can confuse).
Can a small addition to the http.TimeFormat constant documentation be added??

@ianlancetaylor ianlancetaylor changed the title why isn't there any mentioning about the need for usage of UTC with http.TimeFormat?? net/http: why isn't there any mentioning about the need for usage of UTC with http.TimeFormat?? Jan 26, 2016

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jan 26, 2016

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jan 26, 2016

@gopherbot

This comment has been minimized.

Copy link

commented Jan 26, 2016

CL https://golang.org/cl/18933 mentions this issue.

@gopherbot gopherbot closed this in 2c12b81 Jan 26, 2016

@elico

This comment has been minimized.

Copy link
Author

commented Jan 26, 2016

Thanks!

@golang golang locked and limited conversation to collaborators Feb 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.