How can the ambiguity of date formats in strtotime be avoided when converting dates to timestamps?

When converting dates to timestamps using strtotime in PHP, the ambiguity of date formats can be avoided by specifying the format of the date string using the DateTime class. By providing a specific format, strtotime will be able to accurately convert the date to a timestamp without any confusion.

$dateString = "01/02/2022";
$date = DateTime::createFromFormat('m/d/Y', $dateString);
$timestamp = $date->getTimestamp();
echo $timestamp;