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 6474239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:33:50+00:00 2026-05-25T06:33:50+00:00

what I am trying to do with PHP is something I am sure is

  • 0

what I am trying to do with PHP is something I am sure is simple but cannot figure it out. What I need help with is this:

  • We have a Live Chat feature on our website that is turned on & off manually each day between 9am-6pm

  • What I would like is to be able to have the chat turned on & off based on the time. If the time is between 9am-6pm I would like the chat to be turned on. However, if the current time is not between that timeframe, I would like the Live Chat to be turned off.

All I need help with is the time functionality part. I just do not know how to put together the correct functions/if/else statements. Any help is greatly appreciated.

  • 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-05-25T06:33:51+00:00Added an answer on May 25, 2026 at 6:33 am
    $c_time = mktime();
    $open = strtotime('Today 8am');
    $close = strtotime('Today 5pm');
    
    if ($c_time > $open && $c_time < $close) {
        echo 'Chat open.';
    } else {
        echo 'Chat closed.';
    }
    

    Demo: http://codepad.org/2QXXF8Lo (Remember this server may be in another timezone.)

    I suppose technically all you need is:

    $open = strtotime('8am');
    $close = strtotime('5pm');
    

    http://codepad.org/e0xjCuji

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use something along the lines of unexpand -t 4 *.php but
hey guys, this might be really stupid, but hopefully someone can help. I'm trying
I'm trying to make a non-WSDL call in PHP (5.2.5) like this. I'm sure
Sure I'm missing something simple here. I'm trying to assign a value to a
I'm trying to layout a simple three-column header, but something's not working quite right.
I am sure this is probably something simple that i am not doing. Running
I have been trying to do something like below. JavaScript $.ajax({ url: 'login.php', type:
I'm trying to do something that I thought was simple but doesn't appear to
I'm sure what I'm trying is very simple, but I've never quite worked with
I'm trying to write someting into the DB using PHP but if I try

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.