Mango::BSON::Time(3pm)

Mango::BSON::Time3pm

Datetime type

Usage

  use Mango::BSON::Time;
  my $time = Mango::BSON::Time->new(time * 1000);
  say $time->to_epoch;

Overview

Mango::BSON::Time is a container for the BSON datetime type used by Mango::BSON.

Methods

Mango::BSON::Time inherits all methods from Mojo::Base and implements the following new ones.

new

  my $time = Mango::BSON::Time->new;
  my $time = Mango::BSON::Time->new(time * 1000);

Construct a new Mango::BSON::Time object.

To_json

  my $num = $time->TO_JSON;

Numeric representation of time.

to_datetime

  my $str = $time->to_datetime;

Convert time to RFC 3339 <http://tools.ietf.org/html/rfc3339> date and time.

to_epoch

  my $epoch = $time->to_epoch;

Convert time to floating seconds since the epoch.

to_string

  my $str = $time->to_string;

Stringify time.

Operators

Mango::BSON::Time overloads the following operators.

bool

  my $bool = !!$time;

Always true.

stringify

  my $str = "$time";

Alias for "to_string".

Releases

6 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9
  3. 10
  4. 11–13

From libmango-perl 1.30-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.