-
Notifications
You must be signed in to change notification settings - Fork 18k
time: want more control over time.Format #9547
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
Comments
Use the reference time. This is explained in the docs: http://golang.org/pkg/time/#pkg-constants |
I read that documentation. I find nothing there that lets me distinguish years, months and days in a concatenated string. It just will not do what I want it to do. |
@cespare Maybe there is a fix between 1.3.3 and 1.4? You can see that I did not get the correct year in my example. |
@ddietterich as @bradfitz said, you need to use the reference time, not some other time of your choosing. (Examine carefully the difference between your code and mine.) |
OK, I get it. |
Using go version go1.3.3 linux/amd64
Prints:
I want YYYYMMDD, but time.Format is only layout by example, so it cannot know what digits mean year, month, day. I have to do it by hand.
The text was updated successfully, but these errors were encountered: