1Mojo::Date(3) User Contributed Perl Documentation Mojo::Date(3)
2
3
4
6 Mojo::Date - HTTP 1.1 Date Container
7
9 use Mojo::Date;
10
11 my $date = Mojo::Date->new(784111777);
12 my $http_date = $date->to_string;
13 $date->parse('Sun, 06 Nov 1994 08:49:37 GMT');
14 my $epoch = $date->epoch;
15
17 Mojo::Date implements HTTP 1.1 date and time functions according to RFC
18 2616.
19
20 Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
21 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
22 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
23
25 Mojo::Date implements the following attributes.
26
27 "epoch"
28 my $epoch = $date->epoch;
29 $date = $date->epoch(784111777);
30
31 Epoch seconds.
32
34 Mojo::Date inherits all methods from Mojo::Base and implements the
35 following new ones.
36
37 "new"
38 my $date = Mojo::Date->new;
39 my $date = Mojo::Date->new($string);
40
41 Construct a new Mojo::Date object.
42
43 "parse"
44 $date = $date->parse('Sun Nov 6 08:49:37 1994');
45
46 Parsable formats include:
47
48 - Epoch format (784111777)
49 - RFC 822/1123 (Sun, 06 Nov 1994 08:49:37 GMT)
50 - RFC 850/1036 (Sunday, 06-Nov-94 08:49:37 GMT)
51 - ANSI C asctime() (Sun Nov 6 08:49:37 1994)
52
53 "to_string"
54 my $string = $date->to_string;
55
56 Render date suitable for HTTP 1.1 messages.
57
59 Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.
60
61
62
63perl v5.12.3 2010-08-12 Mojo::Date(3)