perl get day month year code example
Example 1: perl get date
# For Perl only
# syntax
use POSIX;
use Time::Piece;
my $CurTime = localtime(); # <-- Format: Day Month Date HH:MM:SS (ei: Thu May 7 08:45:52 2020)
my $FormattedTime = $local_time->strftime('<FormatOfDateTime>');
# example
use POSIX;
use Time::Piece;
my $CurTime = localtime();
print "[CurTime:$CurTime]\n";
# Note: for formatting, search Perl DateTime Formatting
Example 2: perl date format
# For Perl only
# syntax
use POSIX;
use Time::Piece;
my $CurTime = localtime(); # <-- Format: Day Month Date HH:MM:SS (ei: Thu May 7 08:45:52 2020)
my $FormattedTime = $local_time->strftime('<FormatOfDateTime>');
# example
use POSIX;
use Time::Piece;
my $CurTime = localtime();
print "[CurTime:$CurTime]\n";
# Note: for formatting, search Perl DateTime Formatting