To get when a file was last modified, use File.mtime:
puts File.mtime("main.rb")
The format of the preceding date is specific to Ruby version.
The time is returned as a Time object, so you can get more information directly:
t = File.mtime("main.rb") puts t.hour # w w w . ja v a 2 s.co m puts t.min puts t.sec