Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:28:52+00:00 2026-06-13T13:28:52+00:00

I know how to set a PHP Cookie and how to make it expire

  • 0

I know how to set a PHP Cookie and how to make it expire in a set time, say 24 hours but how can I make a cookie expire at minute before the servers midnight everyday, so 23:59?

I’ve tried the following but it doesn’t seem to set for me?

setcookie("cons", 1, mktime(24, 0, 0) - time(), "/");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:28:53+00:00Added an answer on June 13, 2026 at 1:28 pm

    You might find strtotime useful in these situations.

    <?php
    setcookie('cons', 1, strtotime('today 23:59'), '/');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use setcookie(user, , time()-3600) to delete a cookie from php, but
Can I access a cookie written with jQuery's cookie plug-in with PHP? I know
I want to know if I can make a PHP function like function john(),
Is there a way to know where is set a given PHP config property?
like in java I have: Class.getSuperClass().getDeclaredFields() how I can know and set private field
Excerpt from http://php.about.com/od/advancedphp/ss/php_sessions.htm : So how will it know it's me? Most sessions set
I try to set a cookie for 2 radio buttons and i don't know
This little PHP snippet is used to set a cookie that lets me determine
I am trying to set a cookie using PHP, so it's the same as
My questions is about redirection from PHP . I know that we can redirect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.