No, not directly.
- You set a cookie's name, value, path, and expiration time in the browser.
- On next request of the site from the browser, the browser sends the
cookie name and value only as a header.
Expiration date/time is not sent. The way you would do this is set two cookies: your cookie and one something like "MY_SITE_C_EXPIRE" with the value of the cookie being the expiration date/time.
Then you can read THIS cookie to do the math on your alert. Be sure to set and get both of them at the exact same time so they always stay synchronized.
Alternatively, you could just store the time in a DB as soon as it's set, and update it whenever the cookie is set. Either way.
Warning Cookie expires tomorrow!
Unless this is a limited time offer sort of thing, there's not a whole lot of benefit to this. Most people don't even know what a cookie is, seeing such a message might prompt them to remember Uncle Bob telling them cookies are evil, and be the trigger to go disable them. I'm exaggerating (or am I) but you get the point.
Cookies should be managed transparently, for example, as someone logs in and visits a site, the expiration should automatically be updated with each page request, expiring only after period of inactivity. In the "limited time offer" scenario, it should be worded like "You have until tomorrow to take advantage of this deal" - one of the marketer's favorites, call to action.