Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
// Set the timezone to the appropriate timezone
date_default_timezone_set('Europe/London');
// Get the current date
$current_date = date('Y-m-d');
// Determine the start and end dates for the current period
if (date('d', strtotime($current_date)) <= 11) {
$start_date_1st = date('Y-m-12', strtotime('-1 month', strtotime($current_date)));
$end_date_1st = date('Y-m-11', strtotime($current_date));
} else {
$start_date_1st = date('Y-m-12', strtotime($current_date));
$end_date_1st = date('Y-m-11', strtotime('+1 month', strtotime($current_date)));
}
// Format the start and end dates as "Month, day"
$start_date_formatted_1st = date('F, jS', strtotime($start_date_1st));
$end_date_formatted_1st = date('F, jS', strtotime($end_date_1st));
$today_formatted = date('F, jS', strtotime($current_date));
if ($today_formatted == $start_date_formatted_1st) {
$start_date_formatted_1st = "Today";
}
// Query the
?>
<h6 style="color:black;margin-top:0;"><?php echo $start_date_formatted_1st . ' - ' . $end_date_formatted_1st;?></h6>
<?php if (!empty($firstResult['price'])):?>
<h3 style="color:black;" >£<?php echo number_format(round($avgMonth, 2), 2);?></h3>
<?php endif ?>
<?php if (empty($firstResult['price'])):?>
<h3 style="color:black;" >£0.00</h3>
<?php endif ?>