File::time()

Gets the file creation time.

Table of Contents
  1. Description
  2. Example

Description

File::time(?string $format = null): int|string;

This method returns the file creation time in Unix time stamp format by default.

Example

$file = new File('.\path\to\file.txt');

$time = $file->time(); // Returns `1668304188`
$time = $file->time('%Y-%m-%d %T'); // Returns `'2022-11-13 08:49:48'`

For Windows this method returns the creation time, and for Unix this method returns the change time. On Unix, there is no creation time (in most file systems).

File::size()

Gets the file sizes in human readable string format.

File::time()

Gets the file creation time.