Hi guys im trying to convert an employee schedule from asia/manila timezone to america/los_angeles but i got error because of the day off schedule when converting it using this code
$datecon = new DateTime($date[$a].' '.$time[$a], new
DateTimeZone('Asia/Manila'));
$datecon->setTimezone(new DateTimeZone('America/Los_Angeles'));
heres the error
Sunday, 04/07/2019 | DAY OFF Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (04/07/2019 DAY OFF) at position 11 (D): The timezone could not be found in the database in C:\xampp\htdocs\test\index.php:38 Stack trace: #0 C:\xampp\htdocs\test\index.php(38): DateTime->__construct('04/07/2019 DAY ...', Object(DateTimeZone)) #1 {main} thrown in C:\xampp\htdocs\test\index.php on line 38
<table class="table table-bordered col-lg-6">
<thead class="thead-dark">
<tr>
<td>Asia/Manila
</td>
<td>America/Los_Angeles
</td>
</tr>
</thead>
<tbody>
<?php
$date = array('04/07/2019','04/08/2019','04/09/2019','04/10/2019','04/11/2019','04/12/2019','04/13/2019','04/14/2019','04/15/2019','04/16/2019','04/17/2019','04/18/2019','04/19/2019','04/20/2019');
$time = array('DAY OFF','DAY OFF','12:00 AM','12:00 AM','12:00 AM','12:00 AM','12:00 AM','DAY OFF','11:00 PM','11:00 PM','11:00 PM','1:00 PM','1:00 PM','DAY OFF');
$day = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
$timezone = 'America/Los_Angeles';
for($a=0; $a < 14; $a++){
echo '<tr><td>';
echo $day[$a].', '.$date[$a].' | <b>'.$time[$a].'</b>';
$datecon = new DateTime($date[$a].' '.$time[$a], new
DateTimeZone('Asia/Manila'));
$datecon->setTimezone(new DateTimeZone('America/Los_Angeles'));
echo '<td>';
echo $day[$a].', '.$date[$a].'</td>';
echo '</tr>';
}
?>
</tbody>