Using Ruby 2.1, I am trying to find a backlink Time#strftime('%Y%U'). For instance:
s = Time.parse("2014-05-07 16:41:48 -0700").strftime('%Y%U')
t = Time.strptime(s, '%Y%U')
This section was suggested for use %G, so I read the documents and tried, but all that I chose is the current time. eg:
t = Time.strptime('201418', '%G%U')
From the documents, he looks at me, which %Gis only intended to work with %V, since both ISO 8601 and %Uno, but even using %G%VI will return the current time.
So what is the right way to turn a string %Y%Uinto an appropriate one Time?
seth source
share