Skip to content
instance method

File::Stat#birthtime

() -> ::Time
stat.birthtime → time

Returns the birth time for stat.

If the platform doesn’t have birthtime, raises NotImplementedError.

Example
File.write("testfile", "foo")
sleep 10
File.write("testfile", "bar")
sleep 10
File.chmod(0644, "testfile")
sleep 10
File.read("testfile")
File.stat("testfile").birthtime   #=> 2014-02-24 11:19:17 +0900
File.stat("testfile").mtime       #=> 2014-02-24 11:19:27 +0900
File.stat("testfile").ctime       #=> 2014-02-24 11:19:37 +0900
File.stat("testfile").atime       #=> 2014-02-24 11:19:47 +0900

Ruby version changes

  1. 4.0
See also #atime #blksize #<=> #blockdev? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0