How can a cookie be set to expire on a specific date and time in PHP?

To set a cookie to expire on a specific date and time in PHP, you can calculate the expiration time by adding the desired number of seconds to the current time using the `time()` function. Then, use the `setcookie()` function to set the cookie with the calculated expiration time.

$expiryTime = strtotime('2023-01-01 00:00:00'); // Set the desired expiration date and time
setcookie('cookie_name', 'cookie_value', $expiryTime);