localtime converts a time into the local time. : date time « Data Type « Perl






localtime converts a time into the local time.

  
            
The localtime function converts a time value into an array of nine elements. 

You can extract each of the elements with code like the following: 

($sec, $min, $hour, $dom, $mon, $year, $wday, $yday, $isdst) = localtime($time);

Array Values Returned by localtime Functions 
Value      Holds
$sec       Seconds after the minute, from 0 to 59.
$min       Minutes after the hour, from 0 to 59.
$hour      Hour of day, from 0 to 23.
$dom       Day of month, from 1 to 31.
$mon       Month of year, from 0 to 11.
$year      Years since 1900.
$wday      Days since Sunday, from 0 to 6.
$yday      Days since January 1, from 0 to 365.
$isdst     Daylight-savings time; > 0 if in effect, 0 if not, < 0 if Perl can't tell.

   
    
  








Related examples in the same category

1.To extract the current date by using time and localtime
2.Set the value of localtime to a scalar variable, you'll get a typical UNIX-style time
3.scalar(localtime(time()))
4.Splitting Time
5.Create new time based on the value from localtime
6.Print out the current time in standard time
7.Is leap year subroutine
8.Execute date command and get user input
9.Time of Day
10.Switch Time
11.Converting Time
12.Splitting Local Time
13.gmtime function converts a time value into Greenwich Mean Time