Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Time#strftime explanation of %C format argument #2869

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sho-work
Copy link

@sho-work sho-work commented Jan 27, 2024

概要

Time#strftimeの以下のメソッドで引数が%Cの時に、
一般的な世紀とは異なり、西暦の上2桁を読み込んで返す仕様になっていることをよりわかりやすくするための記述を加えました。

参考

https://docs.ruby-lang.org/ja/latest/method/Time/i/strftime.html#:~:text=%25C%3A%20%E4%B8%96%E7%B4%80%20(2009%E5%B9%B4%E3%81%A7%E3%81%82%E3%82%8C%E3%81%B0%2020)

Copy link
Member

@znz znz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最初の2桁とは限らないので、もうちょっと表現に工夫が必要そうです。

% ruby -e 'p Time.local(100).strftime("%C")'
"01"
% ruby -e 'p Time.local(10000).strftime("%C")'
"100"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants