Actions
Bug #15322
closedTime.strptime does not support %3N, %6N, %9N
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
Description
Time.strptime("2018-11-20 17:11:22.123", "%Y-%m-%d %H:%M:%S.%3N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%3N'
Time.strptime("2018-11-20 17:11:22.123456", "%Y-%m-%d %H:%M:%S.%6N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%6N'
Time.strptime("2018-11-20 17:11:22.123456789", "%Y-%m-%d %H:%M:%S.%9N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%9N'
But RDoc says that (https://docs.ruby-lang.org/en/2.5.0/Time.html#method-c-strptime):
%N
Fractional seconds digits, default is 9 digits (nanosecond)
%3N
millisecond (3 digits)
%6N
microsecond (6 digits)
%9N
nanosecond (9 digits)
%N
works fine for this purpose.
I think we can remove %3N, %6N, and %9N from the document.
In fact, Fluentd users confuse when they read the document to configure Fluentd's parameter.
See also #11220
Files
Updated by okkez (okkez _) almost 6 years ago
- Subject changed from Time.parse does not support %3N, %6N, %9N to Time.strptime does not support %3N, %6N, %9N
- Description updated (diff)
Updated by naruse (Yui NARUSE) almost 6 years ago
You can commit it but ", default is 9 digits " should also be removed.
Updated by okkez (okkez _) almost 6 years ago
Thank you for comments. I will commit the patch.
Updated by okkez (okkez _) almost 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r66145.
time.rb: remove the unsupported formatting options from the document [ci skip]
Time.strptime does not support %3N, %6N, and %9N.
close [Bug #15322]
Actions
Like0
Like0Like0Like0Like0