makeTimestampedDirectory.php
Table of Contents
Functions
- makeTimestampedDirectory() : string|null
- Creates a directory named with a formatted timestamp.
Functions
makeTimestampedDirectory()
Creates a directory named with a formatted timestamp.
makeTimestampedDirectory([string|null $date = null ][, string $basePath = Char::EMPTY ][, string $prefix = Char::EMPTY ][, string $suffix = Char::EMPTY ][, string|null $timezone = 'Europe/Paris' ][, string|null $format = 'Y-m-dTH:i:s' ]) : string|null
Combines a date/time string (or the current time) with optional prefix, suffix, and base path to generate a unique directory name. The directory is created if it does not already exist.
Parameters
- $date : string|null = null
-
Optional date/time string to use. If null or invalid, the current date/time is used ("now").
- $basePath : string = Char::EMPTY
-
Optional base path in which to create the directory. Defaults to an empty string.
- $prefix : string = Char::EMPTY
-
Optional string to prepend to the directory name.
- $suffix : string = Char::EMPTY
-
Optional string to append to the directory name.
- $timezone : string|null = 'Europe/Paris'
-
Timezone identifier (e.g., 'Europe/Paris'). Defaults to 'Europe/Paris'.
- $format : string|null = 'Y-m-dTH:i:s'
-
Date format compatible with DateTime::format(). Defaults to 'Y-m-d\TH:i:s'.
Tags
Return values
string|null —The full path of the created directory, or null on failure.