note 37080 deleted from function.date by nlopess
| From: | nlopess@php.net | Date: | Sat, 30 Jul 2005 16:48:24 +0000 |
| Subject: | note 37080 deleted from function.date by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92763@lists.php.net to get a copy of this message | ||
Note Submitter: jenz at mail dot de
----
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.