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 ) {?>
No need to have
<?phpon 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)