xxxxxxxxxx
echo date('Y-m-d H:i:s');
//Output something like this:
//2021-07-30 10:07:45
xxxxxxxxxx
# Current Time
date_default_timezone_set("America/New_York");
echo "The time is " . date("h:i:sa");
xxxxxxxxxx
<?php
// Set the time zone to the user's preferred time zone
date_default_timezone_set('Your/Timezone');
// Get the current date and time
$currentDateTime = date('Y-m-d H:i:s');
// Display the current date and time
echo $currentDateTime;
?>
xxxxxxxxxx
<?php
// Set the timezone to the user's timezone, or choose a specific timezone
date_default_timezone_set('America/New_York');
// Get the current time
$currentTime = date('Y-m-d H:i:s');
// Display the current time
echo $currentTime;
?>
xxxxxxxxxx
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
// 7 Tage; 24 Stunden; 60 Minuten; 60 Sekunden
echo 'Jetzt: '. date('Y-m-d') ."\n";
echo 'Naechste Woche: '. date('Y-m-d', $nextWeek) ."\n";
// oder strtotime() verwenden:
echo 'Naechste Woche: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>