1
I am trying to show on my site banner s that are not expired date, I have in my bank a banner with the following dates:
The current date is: 2015-02-07
Expiration Date: 2015-02-08
The script I made is like this:
<?php if ($totalRows_rsBanner > 0) { ?>
<?php do {
$imagem = substr($row_rsBanner['imagem'],3);
$url = $row_rsBanner['url'];
$DataAtual = date("Y-m-d"); // data atual
$timestamp_DataAtual = strtotime($DataAtual); // converte para timestamp Unix
$DataExpiracao = $row_rsBanner['data_expiracao']; // data de expiração do anúncio
$timestamp_DataExpiracao = strtotime($DataExpiracao); // converte para timestamp Unix
?>
<?php if ($timestamp_DataAtual > $timestamp_DataExpiracao){ ?>
<li><a href="<?php echo $url; ?>"><img src="<?php echo $imagem; ?>"></a></li>
<?php } ?>
<?php } while ($row_rsBanner = mysql_fetch_assoc($rsBanner)); ?>
<?php } ?>
The field of data_expiracao
is in the format Date
.
Hello @Rodrigo Rigotti, good evening, thank you very much for the hint of using the object, it was even worth.
– adventistapr