Skip to content

x/time: support raw output, no parse #73409

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

Closed
kuafuRace opened this issue Apr 17, 2025 · 3 comments
Closed

x/time: support raw output, no parse #73409

kuafuRace opened this issue Apr 17, 2025 · 3 comments
Labels
Question Issues that are questions about using Go.
Milestone

Comments

@kuafuRace
Copy link

time.Now().Format("2006-01-02 is after `2006-01-02`")

I expected to get:

2025-04-17 is after 2006-01-02

But I actually get:

2025-04-17 is after `2025-04-17`
@gopherbot gopherbot added this to the Unreleased milestone Apr 17, 2025
@gabyhelp gabyhelp added the Question Issues that are questions about using Go. label Apr 17, 2025
@chad-bekmezian-snap
Copy link

I don’t think there is a way to escape the formatted string. But why not just do this?

fmt.Printf("%s is after 2006-01-02", time.Now().Format("2006-01-02"))

@kuafuRace
Copy link
Author

This is just a simple example, it may actually be more complex than this. I hope to use a special character to raw output, such as

time.Now().Format("2006-01-02 is after `2006-01-02`")
or 
time.Now().Format("2006-01-02 is after \2006-01-02\")

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2025
@kuafuRace kuafuRace changed the title x/time: how to raw output, no parse x/time: support raw output, no parse Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Issues that are questions about using Go.
Projects
None yet
Development

No branches or pull requests

5 participants