in reply to Converting Active Directory date Time to something useful

In case someone else is researching this, I've put down a solution that I've cobbled from http://code.activestate.com/lists/perl-win32-users/10905/. I use DateTime objects for my date in my app, so I've pulled the relevant bits out:
use DateTime; use DateTime::Format::Epoch; # Windows epochs start on 1 Jan 1601 my $base_dt = DateTime->new( year => 1601, month => 1, day => 1 ); my $formatter = DateTime::Format::Epoch->new( epoch => $base_dt, unit => 'seconds', type => 'int', # or 'float', 'bigint' skip_leap_seconds => 1, start_at => 0, local_epoch => undef, ); # $value contains the Win32:OLE date my $hi_val = $value->HighPart; my $low_val = $value->LowPart; my $factor = 10000000; my $unp_val = pack("II", $low_val, $hi_val); my ($bVp, $aVp) = unpack("LL", $unp_val); $unp_val = ($aVp * 2**32 + $bVp) / $factor; if ($unp_val != 0) { my $dt = $formatter->parse_datetime($unp_val); # Good habit - always explicitly set to UTC zone before # converting to the local zone $dt->set_time_zone('UTC'); $dt->set_time_zone('local'); print $dt->strftime('%Y-%m-%d %H:%M:%S'); }