Skip to content
Md Rasheduzzaman edited this page May 2, 2024 · 1 revision

How to get latest attendance record?

static public function getTodaysRecords(ZKTeco $self)
    {
        // Get all attendance records from the device
        $attendanceData = self::get($self);

        // Get today's date
        $currentDate = date('Y-m-d');

        // Filter attendance data for today
        $todaysAttendance = array_filter($attendanceData, function($record) use ($currentDate) {
            // Assuming the date format in the attendance data is 'Y-m-d H:i:s'
            return substr($record['timestamp'], 0, 10) === $currentDate;
        });

        return $todaysAttendance;
    }

Following this method you can get today's records.

Clone this wiki locally