Jump to content

Create cookie with time

Featured Replies

Posted

I want to do this for the template, how do I?

Set on 7 days

php

\IPS\Request::i()->setCookie('cookie_name', 'value', \IPS\DateTime::create()->add(new \DateInterval('P7D')));

js

var date = new Date();
date.setDate(date.getDate() + 7);
ips.utils.cookie.set('cookie_name', 'value', date.toUTCString());

 

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.