Revision b9c5b0a8
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/IMAPClient.pm | ||
---|---|---|
228 | 228 |
sub _parse_date { |
229 | 229 |
my ($self, $date) = @_; |
230 | 230 |
return '' unless $date; |
231 |
my $parse_date = $date; |
|
232 |
# replace whitespaces with single space |
|
233 |
$parse_date =~ s/\s+/ /g; |
|
234 |
# remove leading and trailing whitespaces |
|
235 |
$parse_date =~ s/^\s+|\s+$//g; |
|
236 |
# remove day-name |
|
237 |
$parse_date =~ s/^[A-Z][a-z][a-z], //; |
|
238 |
# add missing seconds |
|
239 |
$parse_date =~ s/( \d\d:\d\d) /$1:00 /; |
|
231 | 240 |
my $strp = DateTime::Format::Strptime->new( |
232 |
pattern => '%a, %d %b %Y %H:%M:%S %z',
|
|
241 |
pattern => '%d %b %Y %H:%M:%S %z', |
|
233 | 242 |
time_zone => 'UTC', |
234 | 243 |
); |
235 |
my $dt = $strp->parse_datetime($date); |
|
244 |
my $dt = $strp->parse_datetime($parse_date) |
|
245 |
or die "Could not parse date: $date\n"; |
|
236 | 246 |
return $dt->strftime('%Y-%m-%d %H:%M:%S'); |
237 | 247 |
} |
238 | 248 |
|
Auch abrufbar als: Unified diff
IMAPClient: FIX: Fehler beim Parsen des Datum behoben