To get when a file was last modified, use File.mtime:
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 # from w w w . ja v a2 s .c o m puts t.min puts t.sec