Bug #6491
closedDateTime.strftime('%Z') output is incorrect format
Description
DateTime.parse('2012/05/23').strftime('%Z') should output 'GMT' (or a similar string). It outputs "+00:00" (or a similar offset string).
Updated by naruse (Yui NARUSE) almost 13 years ago
- Status changed from Open to Assigned
- Assignee set to tadf (tadayoshi funaba)
Updated by tadf (tadayoshi funaba) almost 13 years ago
- Status changed from Assigned to Rejected
- Priority changed from Normal to 3
i don't know how to determine such a name.
moreover, GMT is already dead.
this is not a bug, not an incorrect format.
Updated by zombor (Jeremy Bush) almost 13 years ago
Time.parse().strftime('%Z') outputs UTC
. Notice I said "similar format". It should output a human consumable output like Time.strftime('%Z') does. If nothing else, the two identically named functions output two different things.
Updated by zombor (Jeremy Bush) almost 13 years ago
And if it's not a bug, what's the difference between %:z
and %Z
? Currently they basically output the same thing. The documentation says: %Z - Time zone abbreviation name
.
Updated by tadf (tadayoshi funaba) almost 13 years ago
i tried to avoid the term of UTC or similar words here carefully.
because, we use +00:00 as a local time.
ruby's Time object has a mode UTC/local time.
but, DateTime does not so.
DateTime does not have the obvious local time zone.
incorrect?
i don't think so.
iso8601 is a human readable format.
Updated by zombor (Jeremy Bush) almost 13 years ago
If this is expected functionality, then perhaps the documentation should be changed. It clearly says %Z - Time zone abbreviation name
. This in my eyes (and about 10 other ruby developers I asked before i filed this) means UTC, CST, etc.
It may be a human readable format, but it sure isn't the "Time zone abbreviation name" as the documentation says.
Updated by tadf (tadayoshi funaba) almost 13 years ago
Time's one also says.
but, actually it depends on platform.
on windows, may not always return abbreviation.
this may be a matter of common sense.
but, it's not so good for novice.
Updated by kenips (Ken Ip) almost 12 years ago
@tadf (tadayoshi funaba) why is this closed? To me a discrepancy between DateTime.strftime and Time.strftime should either be documented or fixed. You're saying that:
DateTime.now.strftime('%z %Z')
=> "-0400 -04:00"
Time.now.strftime('%z %Z')
=> "-0400 EDT"
is OK?