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

  • SEARCH
  • Home
  • 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 6735945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:04:19+00:00 2026-05-26T11:04:19+00:00

I need to display a link at a very specific time using PHP. The

  • 0

I need to display a link at a very specific time using PHP. The php for the WLSG schedule works and that’s because it’s a pretty simple program that starts on the hour and ends on the hour.

My dilemma is that I have another program that starts at (server time) 23:45 on Sunday and ends at 0:00 on Monday. I’m having issues with it displaying the entire day regardless of the times I’ve entered here. I’ve been tinkering with it for the last hour and just cannot figure out what I’m missing.

Here is my php code:

<?php 
    // Variables
    $h = date('G');
    $m = date('i');
    $d = date('l');

    //WLSG Schedule
    if ($d != 'Monday') $wlsgDayToggle = 'radio-offline';
    if ($h > 0) $wlsgTimeToggle = 'radio-online';
    if ($h < 1) $wlsgTimeToggle = 'radio-online';
    else $wlsgTimeToggle = 'radio-offline';

    //UCR Schedule
    if ($d != 'Sunday') $ucrDayToggle = 'radio-offline';
    if ($h > 23) $ucrTimeToggle = 'radio-online';
    if ($m > 40) $ucrTimeToggle = 'radio-online';
    if ($m < 59) $ucrTimeToggle = 'radio-online';
    else $ucrTimeToggle = 'radio-offline';
?>

Here is the HTML:

<div id="radio-online">
    <p><a class="<?php echo $wlsgDayToggle; ?> <?php echo $wlsgTimeToggle; ?>" href="#" title="Online! Listen Now!" target="_blank">Online! Listen Now!</a></p>
    <p><a class="<?php echo $ucrDayToggle; ?> <?php echo $ucrTimeToggle; ?>" href="#" title="Online! Listen Now!" target="_blank">Online! Listen Now!</a></p>
</div>

And the CSS:

a.radio-online { display: inline; }
a.radio-offline { display: none; }
  • 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-26T11:04:20+00:00Added an answer on May 26, 2026 at 11:04 am

    If you want to “string together the if statements”, as you have just told me in your last comment, you must do (for example):

    if (condition) {
        // code
    } else if (condition) {
        // code
    } else if (condition) {
        // code
    } else {
        // code
    }
    

    But, if you need to display the link between 11:45pm and 11:59pm on Sunday, you could do something simpler:

    if ($d == 'Sunday' && $h == 23 && $m >= 45 && $m <= 59) {
        $ucrTimeToggle = 'radio-online';
    } else {
        $ucrTimeToggle = 'radio-offline';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display link after each comment, when you click that link, a
I need to display 2d images in opengl using textures. The image dimensions are
I have a very simple demo working that uses Webkit transforms and transitions for
I have downloaded and added this very simple, one file, php web file explorer
I'm trying my first very basic Facebook app using php and have stumbled upon
i am developing one application with map view i need display the weather depends
I need to display an error message on rejecting a drop in my application.
I need to display many pages of news in a site. Should I do
I need to display a variable-length message and allow the text to be selectable.
I need to display additional information, like a tooltip, but it's a lot of

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.