'path=' + path + ';'; } So, to create a cookie which will expire after 30 days: 1. In php it's simple: This is 3 months into the future. How to set cookies expiry date in JavaScript? As cookies as a simple piece of text they are not executable. Required. Further, you can use the domain attribute if you want a cookie to be available across subdomains. If set to "/", the cookie will be available within the entire domain. In the code above, newCookie is a string of form key=value.Note that you can only set/update a single cookie at a time using this method. Consider also that: Any of the following cookie attribute values can optionally follow the key-value pair, specifying the cookie to set/update, and preceded by a semi-colon separator: How to create a Cookie in JavaScript? Permanent Cookie: cookie that presents in the browser even after closing Browser, the information you have searched or filled on the Internet, is stored for 1 Day, 1 Month, or 1 year. Directions on how to use the Javascript Cookie Script Download: Javascript Cookie Script Current Version: 1.1… cookie property is used. !