Cookie expiration time

Is it possible to find out when the cookie expires, I set my cookie by doing this

$_COOKIE[] = setcookie("bangUser", $unique, time() + (60*60*24*30));

Is it possible to print the expiration date on the screen?

+3
source share
1 answer

Yes, you can use the date function to print a beautiful version of the timestamp that you pass into your setcookie function. Below is an example of code that you can implement. You can change the date format using the manual on this page .

$expireat = time() + (60*60*24*30);
setcookie("bangUser", $unique, $expireat);
echo date("l jS \of F Y h:i:s A",$expireat)
+3
source

Source: https://habr.com/ru/post/1728491/


All Articles