What are the best practices for converting text date values to a proper date format in PHP for filtering purposes?

When converting text date values to a proper date format in PHP for filtering purposes, it is important to use the strtotime() function to parse the text date into a Unix timestamp, and then use the date() function to format the timestamp into the desired date format. This ensures that the date values are in a standardized format that can be easily compared and filtered.

$textDate = "2022-01-15"; // Example text date value
$properDate = date("Y-m-d", strtotime($textDate));
echo $properDate; // Output: 2022-01-15