1Mango::BSON::Time(3) User Contributed Perl Documentation Mango::BSON::Time(3)
2
3
4
6 Mango::BSON::Time - Datetime type
7
9 use Mango::BSON::Time;
10
11 my $time = Mango::BSON::Time->new(time * 1000);
12 say $time->to_epoch;
13
15 Mango::BSON::Time is a container for the BSON datetime type used by
16 Mango::BSON.
17
19 Mango::BSON::Time inherits all methods from Mojo::Base and implements
20 the following new ones.
21
22 new
23 my $time = Mango::BSON::Time->new;
24 my $time = Mango::BSON::Time->new(time * 1000);
25
26 Construct a new Mango::BSON::Time object.
27
28 TO_JSON
29 my $num = $time->TO_JSON;
30
31 Numeric representation of time.
32
33 to_datetime
34 my $str = $time->to_datetime;
35
36 Convert time to RFC 3339 <http://tools.ietf.org/html/rfc3339> date and
37 time.
38
39 to_epoch
40 my $epoch = $time->to_epoch;
41
42 Convert time to floating seconds since the epoch.
43
44 to_string
45 my $str = $time->to_string;
46
47 Stringify time.
48
50 Mango::BSON::Time overloads the following operators.
51
52 bool
53 my $bool = !!$time;
54
55 Always true.
56
57 stringify
58 my $str = "$time";
59
60 Alias for "to_string".
61
63 Mango, Mojolicious::Guides, <http://mojolicio.us>.
64
65
66
67perl v5.34.0 2022-01-21 Mango::BSON::Time(3)