kamshory / ZKLibrary

ZKLibrary is PHP library for reading and writing data to attendance device using UDP protocol. This library useful to comunicate between web server and attendance device directly without addition program. This library is implemented in the form of class. So that you can create an object and use it functions.
GNU General Public License v2.0
193 stars 176 forks source link

setTime() method not working as intended for me. #109

Closed rosonkhadka closed 3 years ago

rosonkhadka commented 3 years ago

SetTime() method does not update the device time with a given date/time but rather sets current date/time. Eg: Following code should have set the date/time as "2021-02-25 22:16:27" but instead it sets "2021-03-04 17:11:23"

$ip = '100.64.120.20';
$zk = new ZKTeco($ip, 4370);
      if ($zk->connect()) {
            $zk->setTime('2021-02-25 22:16:27');
            echo '<pre>';
            var_dump('Device with IP Address: ' . $ip . ' ' . 'Date and Time Updated.');
            echo '</pre>';
        } else {
            echo '<pre>';
            var_dump('Device with IP Address: ' . $ip . ' ' . 'did not connect.');
            echo '</pre>';
        }
rosonkhadka commented 3 years ago

Had to reset the device.