1, Time function: Returns the cumulative number of seconds from January 1, 1970
Use: My $t =time ();
2. localtime function: Get local time zone
Use: My $t =localtime (Time ());
3. gmtime function: Get GMT
Use: My $t =gmtime (Time ());
Get the format time (take the localtime function for example):
My ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $ISDST) = LocalTime (Time ());
The top three in the top form are the seconds, minutes, and times, the middle three is the number of days, the number of months (starting from 0), the year (relative to 1990), and the last three are the days of the week (weeks), the first days of the year, and daylight saving time.
To format the time by sprintf:
My $format _time=sprintf ("%d-%d-%d%d:%d:%d", $year +1990, $mon +1, $mday, $hour, $min, $sec);
Get shape such as: 2010-8-30-21:00:00 format of the time.
In addition, you can use the Perl date module to get the formatting time.