note 37080 added to function.date

From: Date: Sun, 02 Nov 2003 11:29:33 +0000
Subject: note 37080 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-59649@lists.php.net to get a copy of this message
My problem was to convert the 18digit timestamps from an active directory LDAP server to a unix timestamp. the win32 timestamp occurs for example in the lastlogon entry of the ADS. The time is measured in Win32 epoch beginning in the year 1601. Ticks are in 100nanoseconds. Reference: http://xml-x.org/time.html#time I wrote the following simple function: function win2unix($date_string,$date_timestamp) { $epoch_diff = 11644473600; // difference 1601<>1970 in seconds. see reference URL $date_timestamp = $date_timestamp * 0.0000001; $unix_timestamp = $date_timestamp - $epoch_diff; echo date($date_string,$unix_timestamp); } Now it display me the correct date. ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37080 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37080&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37080&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59649) next »