dimanche 26 septembre 2021

PHP if the current time is mystart

I have Check by Today but I need to check in PHP if the current time is mystart or starttime

I want the message to appear only when my start and disappear when end Time I couldn't adjust it this is my code

$mytime = current_time('Y/m/d');
$mysec = current_time('g:i');
$tomeww = new DateTime('+1day+120 minutes');
$tomew = $tomeww->format('Y/m/d');
$ysetr = new DateTime('-1day+120 minutes');
$yset = $ysetr->format('Y/m/d');
$endTime = strtotime("+120 minutes", strtotime($mysec));
$starttime = strtotime("-120 minutes", strtotime($mysec));
$myend = date('g:i', $endTime);
$mystart = date('g:i', $starttime);
$today = new DateTime('d+120 minutes');
$myToday = $today->format('Y/m/d');


<?php if( $date == $myToday ){ ?>                    
                 
                <div class="all-msgs" style="margin: 15px 0 0;">
                    <?php $msg4 = get_option('msg4') ?>
                    <?php $type_of_msg = get_option('type_of_msg4') ?>
                    <?php if ($type_of_msg == 'note') { ?>
                    <div class="alert alert-msg1" role="alert">
                        <?php echo $msg4; ?>
                    </div>

<?php } else {} ?>

thanks

Aucun commentaire:

Enregistrer un commentaire