Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
How to Set A Cookie Expiration Date To Another Cookie Value

As you know we can read the name and value of a cookie, but we cannot read the cookie's expiration date and time. This is because when the browser sends cookie information to the server, it does not include the expiration information. One solution to get the expiry date is to set the cookie's expiration date to another cookie which can be read later to get the expiration date of first cookie.

Using JavaScript, I have create the first cookie like this

let username = 'geoca';
function setCookie(cName, cValue, expDays) {
        let date = new Date();
        date.setTime(date.getTime() + (expDays * 24 * 60 * 60 * 1000));
        const expires = "expires=" + date.toUTCString();
        document.cookie = cName + "=" + cValue + "; " + expires + "; path=/";
}
setCookie('webexia', username, 30);

now can you please let me know how can I get and set the expiry of webexia cookie (the first cookie) to getexpirey cookie in JavaScript or in PHP?

setCookie('getexpirey', ?????, 30);
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda