Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ruby tips
- # Rubyで時間を扱う
- puts "Current Time : " + time.inspect
- puts time.year # => Year of the date
- puts time.month # => Month of the date (1 to 12)
- puts time.day # => Day of the date (1 to 31 )
- puts time.wday # => 0: Day of week: 0 is Sunday
- puts time.yday # => 365: Day of year
- puts time.hour # => 23: 24-hour clock
- puts time.min # => 59
- puts time.sec # => 59
- puts time.usec # => 999999: microseconds
- puts time.zone # => "UTC": timezone name
- time = Time.new
- puts time.to_s
- # => Mon Jun 02 12:35:19 -0700 2008
- puts time.ctime
- # => Mon Jun 2 12:35:19 2008
- puts time.localtime
- # => Mon Jun 02 12:35:19 -0700 2008
- puts time.strftime("%Y-%m-%d %H:%M:%S")
- # => 2008-06-02 12:35:19
- # エスケープ文字一覧
- ### Backslash notation Hexadecimal character Description
- - \a 0x07 Bell or alert
- - \b 0x08 Backspace
- - \cx Control-x
- - \C-x Control-x
- - \e 0x1b Escape
- - \f 0x0c Formfeed
- - \M-\C-x Meta-Control-x
- - \n 0x0a Newline
- - \nnn Octal notation, where n is in the range 0-7
- - \r 0x0d Carriage return
- - \s 0x20 Space
- - \t 0x09 Tab
- - \v 0x0b Vertical tab
- - \x Character x
- - \xnn Hexadecimal notation, where n is in the range 0-9, a-f, or A-F
- # ローカルのgemを全部アンインストールする
- gem uninstall -axI `gem list --no-versions | egrep -v 'test-unit|rdoc|psych|minitest|io-console|rake|bigdecimal|json'`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement