How to convert Excel date and time to PHP date and time?

Did you know that now you can convert the "Time Format in excel" into PHP code format in the following manner:

Example:

<?php

if (isset($_FILES['your_file_name'])) {

            $path = $_FILES['your_file_name']['input_tag_name'];

            $object = PHPExcel_IOFactory::load($path);

            foreach ($object->getWorksheetIterator() as $worksheet) {

                $highestRow = $worksheet->getHighestRow();

                $highestColumn = $worksheet->getHighestColumn();

 for ($row = 2; $row <= $highestRow; $row++) {

                    if (($worksheet->getCell('A' . $row)->getValue()) != '') {

  $check_out = ($worksheet->getCell($list_of_coloums[$i] . $row)->getValue()) * (24 / 1);

                                $co_hr = floor($check_out);

                                $co_min = floor(($check_out - $co_hr) * (60 / 1));

                                $co_time = strval(($co_hr <= 12) ? $co_hr : $co_hr - 12) . ":" . strval($co_min) . " " .(($co_hr <= 12) ? "AM" : "PM");

                                $co = strval(($co_hr <= 12) ? $co_hr : $co_hr - 12) . ":" . strval($co_min);

                                array_push($co_time_a, $co_time);

}

}

}

}

?>

Sign In or Register to comment.