PHP code example of aminebenhariz / attendance
1. Go to this page and download the library: Download aminebenhariz/attendance library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aminebenhariz / attendance example snippets php
$dayAttendanceLine = '2015-12-12|08:30 (10:00-10:30) (16:00-16:30) 17:30';
$dayAttendance = DayAttendance::parseDayAttendanceLine($dayAttendanceLine);
echo $dayAttendance->getDuration()->format('%H:%I:%S');
// 07:30:00
echo $dayAttendance->exportLine();
// 2015-12-12|08:30 (10:00-10:15) (12:30-13:30) (16:00-16:15) 17:30
php
$day1 = DayAttendance::parseDayAttendanceLine('2015-12-14|08:31 (12:02-13:42) 17:25');
$day2 = DayAttendance::parseDayAttendanceLine('2015-12-15|08:29 (12:21-13:32) (16:12-16:22) 17:24');
$day3 = DayAttendance::parseDayAttendanceLine('2015-12-16|08:52 (12:18-13:12) 17:31');
$day4 = DayAttendance::parseDayAttendanceLine('2015-12-17|08:12 (12:21-13:52) 17:24');
$day5 = DayAttendance::parseDayAttendanceLine('2015-12-18|08:35 (12:24-13:25) 17:42');
$attendance = new Attendance([$day1, $day2, $day3, $day4, $day5]);
echo $attendance->getAverage()->format('%H:%I');
// 07:40