Bug #13810


Inconsistency between Date and Time.strftime("%v")

Added by osteele (Oliver Steele) almost 6 years ago. Updated over 1 year ago.

Target version:


This seems odd. Each function matches its documentation, but the document and implementation of Date.strftime("%v") differs from the documentation and implementations of Time.strftime("%v") and DateTime.strftime("%v").

ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
require 'time'

# %v - VMS date (%e-%b-%Y)
d = Date.iso8601 "2006-01-02T15:04:05-05:00"
puts d.strftime("%v")           # -> 2-Jan-2006
puts d.strftime("%e-%b-%Y")     # -> 2-Jan-2006

# %v - VMS date (%e-%b-%Y)
dt = DateTime.iso8601 "2006-01-02T15:04:05-05:00"
puts dt.strftime("%v")          # -> 2-Jan-2006
puts dt.strftime("%e-%b-%Y")    # -> 2-Jan-2006

# %v - VMS date (%e-%^b-%4Y)
t = Time.iso8601 "2006-01-02T15:04:05-05:00"
puts t.strftime("%v")           # 2-JAN-2006
puts t.strftime("%e-%^b-%4Y")   # 2-JAN-2006

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #4662: Date#strftime %v gives allcaps instead of normal capsClosedtadf (tadayoshi funaba)05/10/2011Actions

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Status changed from Open to Feedback

At r31672, date changed it but no description or rationale.

  • ext/date/date_strftime(date_strftime_with_tmx): "%v" means "%e-%b-%Y".

Does anybody have any pointers?

Updated by osteele (Oliver Steele) almost 6 years ago

Ruby's Time.strftime method (where %v is equivalent to %e-%^b-%4Y) is compatible with VMS time format, and Date.strftime and DateTime.strftime (where it is equivalent to %e-%b-%Y) are not, according to section 27.1.1 Absolute Time Format of "OpenVMS Programming Concepts Manual":

The operating system uses the following format for absolute time. […]



MMM Month (first 3 characters of the month in uppercase)

Actions #3

Updated by wanabe (_ wanabe) almost 6 years ago

  • Related to Bug #4662: Date#strftime %v gives allcaps instead of normal caps added
Actions #4

Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago

  • Tracker changed from Misc to Bug
  • Backport set to 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN

Updated by jeremyevans0 (Jeremy Evans) almost 2 years ago

  • Status changed from Feedback to Open

I submitted a pull request upstream to fix this: However, I'm not sure if the consistency benefit is worth the backwards incompatibility cost.

Actions #6

Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Status changed from Open to Closed

Also available in: Atom PDF