Perl date and time


  Translation results:

Perl is the abbreviation of Practical Extraction and Report Language, which can be translated as "Practical Report Extraction Language".

Perl is a high-level, general-purpose, literal, dynamic programming language.

Perl was originally designed by Larry Wall and was published on December 18, 1987.

Perl borrows features from C, sed, awk, shell scripts, and many other programming languages.

The most important feature of Perl is that Perl integrates regular expression functions and the huge third-party code library CPAN.

Perl date and timesyntax

The functions that handle time in Perl are as follows:

1. The time() function: returns the accumulated number of seconds since January 1, 1970

2. localtime() function: Get the local time zone time

3. gmtime() function: Get the Greenwich Mean Time

Perl date and timeexample

#!/usr/bin/perl
@months = qw(January February March April May June July August September October November December);
@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
print "$mday $months[$mon] $days[$wday]\n";

Popular Recommendations

Home

Videos

Q&A