Copyright © tutorialspoint.com
Syntax
Definition and UsageIn a list context, converts the time specified by EXPR, returning a nine-element array with the time analyzed for the current local time zone. The elements of the array are # 0 1 2 3 4 5 6 7 8 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); If EXPR is omitted, uses the value returned by time. $mday is the day of the month, and $mon is the month itself, in the range 0..11 with 0 indicating January and 11 indicating December. $year is the number of years since 1900, not just the last two digits of the year. That is, $year is 123 in year 2023. The proper way to get a complete 4-digit year is simply: $year += 1900; Return Value
ExampleTry out following example:
It will produce following results:
|
Copyright © tutorialspoint.com