Search notes:

Perl module Time::Piece

#!/usr/bin/perl
use warnings;
use strict;

use feature 'say';

use Time::Piece;

my $t1 = Time::Piece -> strptime ('01:50', '%H:%M');
my $t2 = Time::Piece -> strptime ('03:05', '%H:%M');

my $t_ = $t2 - $t1;  # The result is a Time::Seconds object.

say "Hours between: ", $t_ -> hours;
#
# Hours between: 1.25

# ---------------------------------

my $t_1970 = Time::Piece -> strptime('1970-01-01 00:00:00', '%Y-%m-%d %H:%M:%S');
my $t_foo  = Time::Piece -> strptime('2017-01-24 15:48:25', '%Y-%m-%d %H:%M:%S');

my $secs_since_1970 = $t_foo - $t_1970;

say "Seconds between: ", $secs_since_1970;
say "   Epoch:        ", $t_foo -> epoch;
#
# Seconds between: 1485272905
#    Epoch:        1485272905

# ---------------------------------

my $t_bar = $t_1970 + $secs_since_1970;
print $t_bar -> ymd() . ' ' . $t_bar -> hms() . "\n";
#
# 2017-01-24 15:48:25
Github repository PerlModules, path: /Time/Piece/script.pl
Perl modules.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1741108121, '18.117.104.183', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/Time/Piece/index(71): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78