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
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Is duplicate of Bug #14860: Time.strptime does not work with Julian dates using %j added
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r64028.
time.rb: yday support
- lib/time.rb (Time.make_time): added yday support.
[ruby-core:87545] [Bug #14860]
Actions
Like0
Like0Like0