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

Processing time zone #50

Closed
topazur opened this issue Jul 6, 2022 · 2 comments
Closed

Processing time zone #50

topazur opened this issue Jul 6, 2022 · 2 comments

Comments

@topazur
Copy link

topazur commented Jul 6, 2022

  1. Data obtained through PGSQL contains time fields that carry time zones
  2. Use gin.H to return the response

I get '2022-07-06T10:12:50.672517539Z', but I want '2022-07-06 10:12:50'

How to implement formatting in a generic way?

@techschool
Copy link
Owner

Hi topazur,
You can use the Format function to convert a timestamp into a string, here's some examples:
https://gobyexample.com/time-formatting-parsing
But in my opinion, you should keep the timezone and let the client deal with the formatting by itself. The sever should provide full information.

@topazur
Copy link
Author

topazur commented Jul 7, 2022

Well, that's what I'm doing now, and maybe I haven't found the benefit of doing that yet.
Thank you for your lessons.
They helped me a lot.

@topazur topazur closed this as completed Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants