Determine if date from date field is in the future or today

I have a date field that is being used to set a date for an event.

I would like to compare the date of the event to todays date, in order to echo a label to identify if the event is in the future or happening today.

The labels I would like to output are:
upcoming
next week
this week
tomorrow
today

So far I can achieve the output of ‘today’ or ‘upcoming’ based on the start date:

<? 
$today = date('j F Y');
$startdate = $page->startDate()->toDate('j F Y');

    if($startdate == $today): 
       echo '<span>today</span>';
    elseif($startdate > $today): 
        echo '<span>upcoming</span>';
    endif 
?> 

How do I extend this to also output the other labels based on the starting date?

Is it possible to also put in a specific timezone this is related to?

with thanks!

Take a look at the DateTime class: PHP: DateTime - Manual, it lets you do all sort of date manipulations.

Or check out this plugin which makes dealing with dates a bit more comfortable: Date Methods | Kirby CMS

thank you

Here is the code that worked for me in case someone else finds it helpful

<?php
// Set the timezone to Berlin
date_default_timezone_set('Europe/Berlin');

// Get the start date from Kirby
$startdate = $page->startDate()->toDate('Y-m-d'); // Using 'Y-m-d' format for accurate comparison

// Convert the start date to a DateTime object
$startDateTime = new DateTime($startdate);

// Get the current date without the time component
$today = new DateTime('today');

// Calculate the difference between the start date and today
$interval = $startDateTime->diff($today);
$daysDifference = $interval->days;

// Get the day of the week for the start date
$startDayOfWeek = (int)$startDateTime->format('N'); // 1 (Monday) through 7 (Sunday)

// Output the label based on the difference and day of the week
if ($daysDifference == 0) {
    echo 'today';
} elseif ($daysDifference == 1) {
    echo 'tomorrow';
} elseif ($daysDifference <= 7 && $today->format('N') < $startDayOfWeek) {
    echo 'this week';
} elseif ($daysDifference <= 13) {
    echo 'next week';
} elseif ($startDateTime > $today) {
    echo 'upcoming';
}
?>