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'); }

In reply to Re: Converting Active Directory date Time to something useful by astroboy
in thread Converting Active Directory date Time to something useful by astroboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.