This is the documentation for the development version. There are no official binaries for it; build it from the source code in git. Download links on these pages work only after the release. For the current release, see version 7.0.

localtime()

Deprecated in 5.0.

Please use DateTime class.

localtime(time) => DateTime

Converts time in UNIX format (number of seconds since epoch) to calendar date and time broken down into its components, using server time zone. Function uses either time given in time argument or current time if time is omitted.

Table 1. Parameters

time

Integer

Time as seconds since epoch (1 January 1970 00:00:00 UTC). If omitted, current time is used.

Return

DateTime object.

println(localtime(time()).year); //Will print 2020
println(localtime().year); //Will print 2020