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

Formatting timestamp fractional seconds in PatternFormatter #15

Closed
jwillikers opened this issue Apr 15, 2020 · 3 comments
Closed

Formatting timestamp fractional seconds in PatternFormatter #15

jwillikers opened this issue Apr 15, 2020 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jwillikers
Copy link

Currently, formatting the time always appends the fractional part of the seconds to the string formatted with strftime. I want to include the fractional seconds immediately after the seconds, but also include time zone information at the end of the date-time.

The following example should illustrate this.
I have the date-time format string "%FT%T%z%Z".
This produces 2020-04-15T11:31:08-0500CDT.543.
I would like to be able to format the date-time to look like this: 2020-04-15T11:31:08.543-0500CDT.

@odygrd
Copy link
Owner

odygrd commented Apr 16, 2020

Thanks, this is a good catch, there are a few formats that print seconds and need to be handled
%c %r %T %X %S

@odygrd odygrd added the bug Something isn't working label Apr 16, 2020
@odygrd odygrd changed the title Formatting Fractional Seconds Formatting timestamp fractional seconds in PatternFormatter Apr 16, 2020
@odygrd odygrd closed this as completed in a52d06e Apr 18, 2020
@odygrd
Copy link
Owner

odygrd commented Apr 18, 2020

Hello, this is now fixed. Please see the wiki for an example as the API has slightly changed.
Pass ts format "%FT%T.%Qms%z%Z" to set_pattern(...)

odygrd added a commit that referenced this issue Apr 18, 2020
odygrd added a commit that referenced this issue Apr 18, 2020
@odygrd odygrd added the enhancement New feature or request label Apr 19, 2020
@jwillikers
Copy link
Author

Works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants