https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-03-29T09:07:36ZRuby Issue Tracking SystemRuby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=639542017-03-29T09:07:36Znatan3 (尚美 日高)
<ul></ul><p>I think it contains a deep problem.</p>
<pre><code class="sh syntaxhl" data-language="sh"><span class="nv">$ </span>ruby <span class="nt">-v</span>
ruby 2.4.1p111 <span class="o">(</span>2017-03-22 revision 58053<span class="o">)</span> <span class="o">[</span>x86_64-darwin16]
<span class="nv">$ </span>irb
irb<span class="o">(</span>main<span class="o">)</span>:001:0> require <span class="s1">'date'</span>
<span class="o">=></span> <span class="nb">true
</span>irb<span class="o">(</span>main<span class="o">)</span>:002:0> Time.now.strftime<span class="o">(</span><span class="s1">'%Z'</span><span class="o">)</span>
<span class="o">=></span> <span class="s2">"JST"</span>
irb<span class="o">(</span>main<span class="o">)</span>:003:0> DateTime.now.to_time.strftime<span class="o">(</span><span class="s1">'%Z'</span><span class="o">)</span>
<span class="o">=></span> <span class="s2">""</span>
irb<span class="o">(</span>main<span class="o">)</span>:004:0>
</code></pre>
<p>So, for the moment, I will change the documentation <a href="https://github.com/ruby/ruby/pull/1565" class="external">here</a>.<br>
I changed this expression</p>
<pre><code>%Z - Time zone abbreviation name or something similar information.
</code></pre>
<p>to</p>
<pre><code>%Z - Time zone the same as above %:z (e.g. +09:00)
</code></pre>
<p><a href="https://github.com/ruby/ruby/pull/1565" class="external">https://github.com/ruby/ruby/pull/1565</a></p> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=639552017-03-29T09:09:09Zsorah (Sorah Fukumori)her@sorah.jp
<ul><li><strong>Assignee</strong> set to <i>tadf (tadayoshi funaba)</i></li></ul> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=639692017-03-29T09:54:08Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Assignee</strong> deleted (<del><i>tadf (tadayoshi funaba)</i></del>)</li></ul><p>DateTime wrongly calls timezone offset as "timezone".<br>
It is considered as a documentation issue at this time.</p> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=640142017-03-31T12:43:34Zstomar (Marcus Stollsteimer)
<ul></ul><p>I'd suggest</p>
<pre><code>%Z - Equivalent to %:z (e.g. +09:00)
</code></pre> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=640152017-03-31T13:40:56ZMSP-Greg (Greg L)
<ul></ul><p>Re docs, <a href="https://msp-greg.github.io/ruby_trunk/Core/Time.html#zone-instance_method" class="external">Time#zone</a> seems to indicate that a time zone abbreviation is the return.</p>
<p>On my system (<code>ruby 2.5.0dev (2017-03-19 trunk 58021) [x64-mingw32]</code>), "Central Daylight Time" is returned, not "CDT". Probably OS dependent...</p> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=640182017-03-31T20:39:23Zstomar (Marcus Stollsteimer)
<ul></ul><p>MSP-Greg (Greg L) wrote:</p>
<blockquote>
<p>Re docs, <a href="https://msp-greg.github.io/ruby_trunk/Core/Time.html#zone-instance_method" class="external">Time#zone</a> seems to indicate that a time zone abbreviation is the return.</p>
<p>On my system (<code>ruby 2.5.0dev (2017-03-19 trunk 58021) [x64-mingw32]</code>), "Central Daylight Time" is returned, not "CDT". Probably OS dependent...</p>
</blockquote>
<p>Probably: for me it's an abbreviation (on Linux).</p>
<p>But I don't see the relevance for this issue, which is about DateTime#strftime.</p> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=647302017-05-09T18:56:28Zstomar (Marcus Stollsteimer)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset trunk|r58643.</p>
<hr>
<p>date_core.c: fix docs for %Z format</p>
<ul>
<li>
<p>ext/date/date_core.c: [DOC] fix documentation for %Z format<br>
of {Date,DateTime}.strftime.</p>
<p>Reported by Damon Timm. Based on a patch by nano.<br>
<a href="/issues/13231">[ruby-core:79602]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset fr... (Closed)" href="https://bugs.ruby-lang.org/issues/13231">#13231</a>] [Fix GH-1565]</p>
</li>
</ul> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=655302017-06-29T16:30:29Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN</i> to <i>2.2: WONTFIX, 2.3: REQUIRED, 2.4: REQUIRED</i></li></ul> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=655972017-06-30T12:52:48Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.2: WONTFIX, 2.3: REQUIRED, 2.4: REQUIRED</i> to <i>2.2: WONTFIX, 2.3: DONE, 2.4: REQUIRED</i></li></ul><p>ruby_2_3 r59237 merged revision(s) 58643.</p> Ruby master - Bug #13231: DateTime.strftime("%Z") does not return time zone abbreviation, returns hour and minute offset from UTC with colonhttps://bugs.ruby-lang.org/issues/13231?journal_id=658842017-07-23T07:21:08Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.2: WONTFIX, 2.3: DONE, 2.4: REQUIRED</i> to <i>2.2: WONTFIX, 2.3: DONE, 2.4: DONE</i></li></ul><p>ruby_2_4 r59397 merged revision(s) 58643.</p>