Revision 90ea23f9
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
- ID 90ea23f930a11a22bda8d45df2ac5ec586987fcf
- Vorgänger 3cb3fcdf
SL/IMAPClient.pm | ||
---|---|---|
205 | 205 |
sub _parse_date { |
206 | 206 |
my ($self, $date) = @_; |
207 | 207 |
return '' unless $date; |
208 |
my $parse_date = $date; |
|
209 |
# replace whitespaces with single space |
|
210 |
$parse_date =~ s/\s+/ /g; |
|
211 |
# remove leading and trailing whitespaces |
|
212 |
$parse_date =~ s/^\s+|\s+$//g; |
|
213 |
# remove day-name |
|
214 |
$parse_date =~ s/^[A-Z][a-z][a-z], //; |
|
215 |
# add missing seconds |
|
216 |
$parse_date =~ s/( \d\d:\d\d) /$1:00 /; |
|
208 | 217 |
my $strp = DateTime::Format::Strptime->new( |
209 |
pattern => '%a, %d %b %Y %H:%M:%S %z',
|
|
218 |
pattern => '%d %b %Y %H:%M:%S %z', |
|
210 | 219 |
time_zone => 'UTC', |
211 | 220 |
); |
212 |
my $dt = $strp->parse_datetime($date); |
|
221 |
my $dt = $strp->parse_datetime($parse_date) |
|
222 |
or die "Could not parse date: $date\n"; |
|
213 | 223 |
return $dt->strftime('%Y-%m-%d %H:%M:%S'); |
214 | 224 |
} |
215 | 225 |
|
Auch abrufbar als: Unified diff
IMAPClient: FIX: Fehler beim Parsen des Datum behoben