What are the potential pitfalls of using date functions in PHP for file naming?

When using date functions in PHP for file naming, one potential pitfall is that the date format may contain characters that are not allowed in file names, such as slashes or colons. To avoid this issue, it is recommended to use a date format that only includes alphanumeric characters and underscores.

// Using a date format that only includes alphanumeric characters and underscores
$file_name = 'file_' . date('Ymd_His') . '.txt';