日時を取得・表示(Time.now)
#! /usr/local/bin/ruby today = Time.now wdays = ["日", "月", "火", "水", "木", "金", "土"] print "Content-type: text/html\n\n" print <<END <html> <head> <title>日時取得・表示</title> </head> <body> #{today.year}年#{today.month}月#{today.day}日(#{wdays[today.wday]}) #{today.hour}時#{today.min}分#{today.sec}秒<br> </body> </html> END exit
〔 実行する 〕