Bug #15322
Time.strptime does not support %3N, %6N, %9N
Status:
Closed
Priority:
Normal
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