Project

General

Profile

Bug #14241

Updated by stsuboi (Sougo TSUBOI) over 2 years ago

According to reference manual, Time.strptime() accepts the directive "%W" in a format string, but it seems not to be worked. 
 On the other hand, Date.strptime() accepts "%W" correctly. 

 C:\>ruby -v 
 ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32] 

 C:\>irb 
 irb(main):001:0> require "time" 
 => true 
 irb(main):003:0> irb(main):002:0> Time.strptime("2017 1", "%Y %W").strftime("%F") %W") 
 => "2017-01-01" 2017-01-01 00:00:00 +0900 
 irb(main):004:0> Date.strptime("2017 1", "%Y %W").strftime("%F") %W") 
 => "2017-01-02" <Date: 2017-01-02 ((2457756j,0s,0n),+0s,2299161j)> 

Back