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

Specify date formatting library #44

Open
brendanberg opened this issue Jun 4, 2023 · 0 comments
Open

Specify date formatting library #44

brendanberg opened this issue Jun 4, 2023 · 0 comments

Comments

@brendanberg
Copy link
Owner

Go has a [decent model for date formatting] (https://gosamples.dev/date-time-format-cheatsheet/)based on the date 01/02 03:04:05PM '06 -0700. Each number in the string corresponds to a particular field:

  • 01 - month
  • 02 - day
  • 03 - hour (12h)
  • 04 - minute
  • 05 - second
  • 06 - year
  • 07 - time zone offset

The date 2001-02-03 04:05:06.007PM -0800, however, has fields sorted by duration and therefore is less ambiguous.

  • 01, 2001 - year (2 digit or 4 digit)
  • 02, 2, Feb, February - month (with or without leading zero, abbreviated or full name)
  • 03, 3 - day (with or without leading zero)
  • 04, 4 - hour (12h, with or without leading zero)
  • 16 - hour (24h) (TODO how do you get 24h time without a leading zero)
  • 05 - minute
  • 06 - second
  • 007 - millisecond
  • -0800 - UTC offset

For example:

  • February 3, 2001 4:05 PM
  • 03 Feb 01 16:05:06
  • 3/2/01 4:05 PM
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

1 participant