源代码:
#!/usr/bin/ruby -w # -*- coding: UTF-8 -*- time1 = Time.new puts "当前时间 : " + time1.inspect # Time.now 功能相同 time2 = Time.now puts "当前时间 : " + time2.inspect
运行结果:
#!/usr/bin/ruby -w # -*- coding: UTF-8 -*- time1 = Time.new puts "当前时间 : " + time1.inspect # Time.now 功能相同 time2 = Time.now puts "当前时间 : " + time2.inspect