perl date code example
Example 1: perl get date
use POSIX;
use Time::Piece;
my $CurTime = localtime();
my $FormattedTime = $local_time->strftime('<FormatOfDateTime>');
use POSIX;
use Time::Piece;
my $CurTime = localtime();
print "[CurTime:$CurTime]\n";
Example 2: perl set date
use Time::Piece;
Time::Piece->strptime('<Date-time-input>', '<format-of-input>');
use Time::Piece;
my $date_1 = Time::Piece->strptime('1994-05-25 13:31:18', '%Y-%m-%d %X');
print $date_1 . "\n";
use Time::Piece;
my $date_2 = Time::Piece->strptime('13:31:18 25/05/1994', '%X %d/%m/%Y');
print $date_2 . "<---\n";