I have a page that contains a starting and an ending date field. I want to find if the current time falls between those dates. The time() function returns a time that is 3 hours behind the actual time in my country. So, I ended up using the following code, but I was wondering if there is a simpler, more Kirby-like way to do it:
$timezone = 'Europe/Athens';
$now = time();
$starts = new DateTime($page->starts(), new DateTimezone($timezone));
$ends = new DateTime($page->ends(), new DateTimezone($timezone));
$starts_timestamp = $starts->format('U');
$ends_timestamp = $ends->format('U');
if ($now > $starts_t && $now < $ends_t) {
//...
}