The expiration time is the third parameter in SetCookie(). Use these formats:
| Format | Example | Result |
|---|---|---|
| Minutes | "30m" | Expires in 30 minutes |
| Hours | "2h" | Expires in 2 hours |
| Days | "7d" | Expires in 7 days |
| Months | "1M" | Expires in 1 month |
| Years | "1y" | Expires in 1 year |
Examples:
# Session cookie (no expiration)
&SetCookie("session", $id, "");
# 30-day cookie
&SetCookie("remember", "yes", "30d");
# 1-year cookie
&SetCookie("prefs", $data, "1y");