Actions
Bug #14933
closedTime.strptime with ordinal dates
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Description
Using Time
, I cannot parse an ordinal date (https://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates).
It should work with %j
according to the documentation: https://ruby-doc.org/stdlib-2.5.1/libdoc/time/rdoc/Time.html#method-c-strptime
require "time"
Time.strptime("2018-365", "%Y-%j")
=> 2018-01-01 00:00:00 +0100
I expect 2018-12-31 00:00:00 +0100
It works using DateTime
:
require "date"
DateTime.strptime("2018-365", "%Y-%j").to_time
=> 2018-12-31 00:00:00 +0000
Actions
Like0
Like0Like0