Changeset 15212 for gsdl


Ignore:
Timestamp:
2008-04-24T15:02:54+12:00 (16 years ago)
Author:
kjdon
Message:

for the greenstone archive collection, we are now using monthly archives rather than raw mbox. The date format is slightly different in this case. I have added code to deal with this format too as it may be useful for other people.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/EMAILPlug.pm

    r12169 r15212  
    323323    # Convert the date text to internal date format
    324324    $value = $raw{"Date"};
     325    # proper mbox format: Tue, 07 Jan 2003 17:27:42 +1300
    325326    my ($day, $month, $year) = $value =~ /(\d?\d)\s([A-Z][a-z][a-z])\s(\d\d\d?\d?)/;
     327    if (!defined($day) || !defined($month) || !defined ($year)) {
     328        # try monthly archive format: Wed Apr 23 00:26:08 2008
     329        ($month,$day, $year) = $value =~ /([A-Z][a-z][a-z])\s\s?(\d?\d)\s\d\d:\d\d:\d\d\s(\d\d\d\d)/;
     330    }
     331
    326332    # make some assumptions about the year formatting...
    327333    # some (old) software thinks 2001 is 101, some think 2001 is 01
Note: See TracChangeset for help on using the changeset viewer.