Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda