im trying to set the time in PHP but i don’t know to set the time zone.
<?php
$currentDateTime = time();
$newDateTime = date('h:i A', strtotime($currentDateTime));
?>
<input type="text" name="time" value="<?php echo $newDateTime; ?>">
>Solution :
You can do this by adding the following code:
<?php
date_default_timezone_set('Africa/Johannesburg');
echo date('H:i:s', time());
?>