1Email::Date(3)        User Contributed Perl Documentation       Email::Date(3)
2
3
4

NAME

6       Email::Date - Find and Format Date Headers
7

VERSION

9       version 1.104
10

SYNOPSIS

12         use Email::Date;
13
14         my $email = join '', <>;
15         my $date  = find_date($email);
16         print $date->ymd;
17
18         my $header = format_date($date->epoch);
19
20         Email::Simple->create(
21             header => [
22                 Date => $header,
23             ],
24             body => '...',
25         );
26

DESCRIPTION

28       Achtung!  Probably you'll be find just using Email::Date::Format to
29       produce dates or Date::Parse to parse dates.  This module isn't much
30       needed anymore, but does provide "find_date", described below.
31
32       RFC 2822 defines the "Date:" header. It declares the header a required
33       part of an email message. The syntax for date headers is clearly laid
34       out. Stil, even a perfectly planned world has storms. The truth is,
35       many programs get it wrong. Very wrong. Or, they don't include a
36       "Date:" header at all. This often forces you to look elsewhere for the
37       date, and hoping to find something.
38
39       For this reason, the tedious process of looking for a valid date has
40       been encapsulated in this software. Further, the process of creating
41       RFC compliant date strings is also found in this software.
42

FUNCTIONS

44   find_date
45         my $time_piece = find_date $email;
46
47       "find_date" accepts an email message in any format Email::Abstract can
48       understand. It looks through the email message and finds a date,
49       converting it to a Time::Piece object.
50
51       If it can't find a date, it returns false.
52
53       "find_date" is exported by default.
54
55   format_date
56         my $date = format_date; # now
57         my $date = format_date( time - 60*60 ); # one hour ago
58
59       "format_date" accepts an epoch value, such as the one returned by
60       "time".  It returns a string representing the date and time of the
61       input, as specified in RFC 2822. If no input value is provided, the
62       current value of "time" is used.
63
64       "format_date" is exported by default.
65
66   format_gmdate
67         my $date = format_gmdate;
68
69       "format_gmdate" is identical to "format_date", but it will return a
70       string indicating the time in Greenwich Mean Time, rather than local
71       time.
72
73       "format_gmdate" is exported on demand, but not by default.
74

AUTHORS

76       •   Casey West
77
78       •   Ricardo SIGNES <rjbs@cpan.org>
79
81       This software is copyright (c) 2004 by Casey West.
82
83       This is free software; you can redistribute it and/or modify it under
84       the same terms as the Perl 5 programming language system itself.
85
86
87
88perl v5.32.1                      2021-01-27                    Email::Date(3)
Impressum