in reply to Active Directory ldifde() time format conversion question


This looks like a Windows VT_FILETIME data type which is a 64 bit unsigned integer representing the number of elapsed 100 nanoseconds since 1 January 1601. A quick check with bc seems to put it in the right ballpark (omitting leap-days):
$ bc 2002-1601 401 401*365*24*60*60*10^7 126459360000000000

There are functions to do this conversion buried in the internals of OLE::Storage and OLE::Storage_Lite and perhaps in some other Win32 modules as well. But you could roll your own conversion with Date::Calc:

#!/usr/bin/perl -wl use strict; use Date::Calc 'Add_Delta_DHMS'; my $vt_filetime = '126697423010137600'; # Disregard the 100 nanosecond units (rounding might be better) $vt_filetime = substr($vt_filetime, 0, 11); my $days = int( $vt_filetime / (24*60*60) ); my $hours = int( ($vt_filetime % (24*60*60)) / (60*60) ); my $mins = int( ($vt_filetime % (60*60)) / 60 ); my $secs = $vt_filetime % 60 ; my @date = Add_Delta_DHMS(1601, 1, 1, 0, 0, 0, $days, $hours, $min +s, $secs); # Format @date as you wish print "@date"; __END__ Prints: 2002 6 28 12 51 41

--
John.