「Ruby入門」Timeのインスタンス作成サンプル

2020年12月26日

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/usr/bin/ruby
# -*- coding: UTF-8 -*-
cftA = Time.now
cftB = Time.local(2020,1,2,3,45)
puts(cftA)
puts(cftB)
#!/usr/bin/ruby # -*- coding: UTF-8 -*- cftA = Time.now cftB = Time.local(2020,1,2,3,45) puts(cftA) puts(cftB)
#!/usr/bin/ruby
# -*- coding: UTF-8 -*-

cftA =  Time.now
cftB = Time.local(2020,1,2,3,45)
puts(cftA)
puts(cftB)

実行結果
>ruby test.rb
2020-12-26 20:28:15 +0900
2020-01-02 03:45:00 +0900

Ruby

Posted by arkgame