Project

General

Profile

Bug #6282

strptime and fractions of seconds

Added by lparra (Luis Parravicini) over 8 years ago. Updated over 2 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
[ruby-core:44291]

Description

=begin
DateTime::strptime refers us to #strftime to check the format to use.
DateTime#strftime says fractions of seconds can be specified with %N, %3N, %6N, %9N and %12N but strptime only recognizes %N.

d = DateTime.strptime("1:2:3.123", '%H:%M:%S.%3N')
ArgumentError: invalid date

And this works:

d = DateTime.strptime("1:2:3.1234567901234567890", '%H:%M:%S.%N')
d.sec_fraction
=> (123456790123456789/1000000000000000000)

I don't know whether it's a bug or the intended functionality but shouldn't it say somewhere in the documentation about this?

=end


Related issues

Related to Ruby master - Feature #11220: strptime(%6N)RejectedActions

Updated by naruse (Yui NARUSE) over 8 years ago

  • Category set to ext
  • Status changed from Open to Assigned
  • Assignee set to tadf (tadayoshi funaba)

Updated by tadf (tadayoshi funaba) over 8 years ago

  • Status changed from Assigned to Rejected

strptime does not support such an extension.

Updated by lparra (Luis Parravicini) over 8 years ago

I know, but where on the docs say so?

Updated by naruse (Yui NARUSE) over 8 years ago

lparra (Luis Parravicini) wrote:

I know, but where on the docs say so?

r35312 adds the doc.

#6

Updated by naruse (Yui NARUSE) over 5 years ago

Updated by mhsver (Michael S) over 2 years ago

The docs at ruby-doc.org doesn't seem to reflect the fact that this functionality isn't available.

Also available in: Atom PDF