Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I searched for OLE Date [google.com] and got this link [newobjects.com] which confirmed my suspicion that OLE dates are just like Excel dates, the number of days since 1900. The fractional part is the fraction of a day. Mac Excel is Just Different, and I guess the same will go for all other Mac Office products that use 1904 as epoch.

  • I believe I at one point had to write an implementation for one weird Microsoft DateTime format in Archive::Zip, have a look in there.

    And it was indeed something very very odd.
    • I found the particular set of routines you mentioned, but alas they don't appear to apply to the date values returned by Outlook :( Using your algorithm I get 'Thu Jan 4 12:24:00 2007' +/- up to 2 minutes for every entry during 2004, 2005 and 2006.

      There are a few websites where they mention odd handling of the Win32 dates, but none that I've found that mention the algorithms used to convert into any human readable format or even a Unix format :(

  • I had a problem with the lastLogin field of user accounts when querying ADSI with Win32::OLE.

    The trick was to use Win32::OLE::Variant:

    use Win32::OLE::Variant;
    use Time::Local;

    #snipped for brevity

    my $unixtime = date2unix( Variant(VT_DATE, $object->Get("lastLogin")) );

    exit 0;

    sub date2unix {
      my $date = shift || return -11644473600;

      if ($date =~ /^([0-9]{2})\/([0-9]{2})\/([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/) {
         return timelocal($6,$5,$4,$1,$2-1,$3);
      }
    }

    If

    • Excellent. Doesn't work for all values, but works for most. I think I now owe you much beer :)

      A new version of Mail::Outlook out soon ;)