DateTime::Format::Epoch 0.10 review

Download
by rbytes.net on

DateTime::Format::Epoch is a Perl module that can convert DateTimes to/from epoch seconds. SYNOPSIS use DateTime::Format::Epo

License: Perl Artistic License
File size: 16K
Developer: Eugene van der Pijli
0 stars award from rbytes.net

DateTime::Format::Epoch is a Perl module that can convert DateTimes to/from epoch seconds.

SYNOPSIS

use DateTime::Format::Epoch;

my $dt = DateTime->new( year => 1970, month => 1, day => 1 );
my $formatter = DateTime::Format::Epoch->new(
epoch => $dt,
unit => 'seconds',
type => 'int', # or 'float', 'bigint'
skip_leap_secondss => 1,
start_at => 0,
local_epoch => undef,
);

my $dt2 = $formatter->parse_datetime( 1051488000 );
# 2003-04-28T00:00:00

$formatter->format_datetime($dt2);
# 1051488000

This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since a given epoch. It can also do the reverse.

Requirements:
Perl

DateTime::Format::Epoch 0.10 search tags