Created
March 3, 2014 06:35
-
-
Save yusukeaiko/9319552 to your computer and use it in GitHub Desktop.
日付/時間フォーマットのデフォルトを設定 ref: http://qiita.com/Vit-Symty/items/399c77d1fd681b77d593
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Time.now.to_s | |
=> 2014-03-03 15:21:57 +0900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Time.now.to_s | |
=> "2014/03/03 15:22" | |
> Time.now.to_s(:date) | |
=> "2014/03/03" | |
> Time.now.to_s(:datetime) | |
=> "2014/03/03 15:23" | |
> Time.now.to_s(:time) | |
=> "15:23:07" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Time::DATE_FORMATS[:default] = '%Y/%m/%d %H:%M' | |
Time::DATE_FORMATS[:datetime] = '%Y/%m/%d %H:%M' | |
Time::DATE_FORMATS[:date] = '%Y/%m/%d' | |
Time::DATE_FORMATS[:time] = '%H:%M:%S' | |
Date::DATE_FORMATS[:default] = '%Y/%m/%d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment