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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:30:09+00:00 2026-05-25T21:30:09+00:00

I need some php help here is my code <?php // Define your target

  • 0

I need some php help

here is my code

<?php
    // Define your target date here
    $targetYear  = get_theme_option('episode_countdown_year');
    $targetMonth = get_theme_option('episode_countdown_month');
    $targetDay   = get_theme_option('episode_countdown_day');
    $targetHour  = 21;
    $targetMinute= 00;
    $targetSecond= 00;
    date_default_timezone_set ( "America/New_York" );
    // Sets the default time zone, in this case GMT -08

    $dateFormat = ( "Y-m-d H:i:s" );
    // Check the PHP Documentation for date uses.
    $targetDate = mktime (
                $targetHour,
                $targetMinute,
                $targetSecond,
                $targetMonth,
                $targetDay,
                $targetYear
    );
    // Sets up our timer
    $actualDate = time();
    // Gets the actual date
    $secondsDiff = $targetDate - $actualDate;
    // Finds the difference between the target date and the actual date
    // These do some simple arithmatic to get days, hours, and minutes out of seconds.
    $remainingDay    = floor ( $secondsDiff / 60 / 60 / 24);
    $remainingHour    = floor ( ( $secondsDiff - ( $remainingDay
                *60 * 60 * 24) ) / 60 / 60 );
    $remainingMinutes = floor ( ( $secondsDiff - ( $remainingDay
                *60 * 60 * 24) - ( $remainingHour * 60 * 60 ) ) / 60 );
    $remainingSeconds = floor ( ( $secondsDiff - ( $remainingDay
                *60 * 60 * 24) - ( $remainingHour * 60 * 60 ) ) -
                ( $remainingMinutes * 60 ) );

    $targetDateDisplay = date($dateFormat,$targetDate);
    $actualDateDisplay = date($dateFormat,$actualDate);
    // Sets up displays of actual and target
    ?>
       <?php if( $targetDate > $actualDate ) {?>  
        description: '<?php echo $remainingDay; ?> Day(s) / <?php echo $remainingHour; ?> Hour(s) / <?php echo $remainingMinutes; ?> Minute(s) Left..',
        picture: '<?php echo $my_url ?>/cache/image-<?php echo $remainingDay; ?>-d.png'
              <?php } else { ?>
        description: 'Now Showing!',
              picture: '<?php echo $my_url ?>/image-now.php'
       <?php } ?>

my question is

How can I add the else if code, if there is less than 1 day left

so I can hide the remainingDay, so only the hours and minutes are showing

I tried this but that didnt work

<?php } else if( $remainingDay < $actualDate ) {?>
  • 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-25T21:30:09+00:00Added an answer on May 25, 2026 at 9:30 pm

    No need to have <?php on the line right after ?>, just keep it open. But if you just want to have code for less than one day, try: (sorry i edited so much)

    <?php if( $targetDate > $actualDate ) {
        if($remainingHour < 24){      //main change here..
          //have < 1 day code here
        } else {  
          echo "description: '$remainingDay Day(s) / $remainingHour Hour(s) / $remainingMinutes Minute(s) Left..'
          picture: '$my_url /cache/image-$remainingDay-d.png'";
      } else { ?>
        description: 'Now Showing!',
        picture: '<?php echo $my_url ?>/image-now.php'
       <?php } ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with re-working the logic on this php code. What I'd
Hi I need some help with the following scenario in php. I have a
I need some comparing and replacing code in PHP Our mission is to empower
I am a bit new to sql and php so I need some help
I have some php code $_SESSION['username'] and I need to display it using html
I'm no php expert (a mere beginner) but need some help! After hours searching
I need some help structuring my php. I am trying to get 3 different
I need some help with some advanced file include code.. I googled around, but
Ok need some help here. I have an autocomplete setup to pull from a
I need some help with the following code... How do I create the array

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.