What are the best practices for setting ModifyDate or CreationDate in a PDF file using PHP's touch function?

When setting the ModifyDate or CreationDate in a PDF file using PHP's touch function, you need to convert the desired date and time into a Unix timestamp format. This can be achieved using the strtotime function in PHP. Once you have the timestamp, you can use the touch function to set the ModifyDate or CreationDate of the PDF file.

// Set the desired date and time
$date = "2022-01-01 12:00:00";

// Convert the date and time into a Unix timestamp
$timestamp = strtotime($date);

// Set the ModifyDate and CreationDate of the PDF file
$pdfFile = 'example.pdf';
touch($pdfFile, $timestamp);