Browse Source

fragments: time-piece.pl

Just a bit of stuff on usage of Time::Piece.
main
Brennen Bearnes 10 months ago
parent
commit
2ef0ccfc32
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      home/fragments/time-piece.pl

+ 15
- 0
home/fragments/time-piece.pl View File

@ -0,0 +1,15 @@
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.0;
use Time::Piece;
my $specific_time = Time::Piece->strptime('2020-11-06 20:20:01', "%Y-%m-%d %T");
say $specific_time;
my $now = localtime();
say $now->epoch;
my $hour_ago = localtime()->epoch - 3600;
say $hour_ago;

Loading…
Cancel
Save