Difference between revisions of "NXSL:localtime"

448 bytes removed ,  21:09, 21 April 2012
no edit summary
Line 1: Line 1:
<syntaxhighlight>localtime([time])</syntaxhighlight>
__NOTOC__
Converts time in UNIX format (number of seconds since epoch) to calendar date and time broken down into its components. Function uses either time given in time argument or current time if time is omitted.


Converts time in UNIX format (number of seconds since epoch) to calendar date and time broken down into its components. Function uses either time given in time argument or current time if time is omitted. Return value is an object of class TIME with the following attributes:
 
{| class="wikitable"
== Syntax ==
|-
 
! Attribute !! Synonym !! Meaning
localtime(''time'');
|-
 
| sec || tm_sec || Seconds after the minute
 
|-
== Parameters ==
| min || tm_min || Minutes after the hour
 
|-
:{|
| hour || tm_hour || Hours since midnight
|-
| mday || tm_mday || Day of the month
|-
|-
| mon || tm_mon || Months since January  
| ''time'' || Time as seconds since epoch (1 January 1970 00:00:00 UTC). If omitted, current time is used.
|-
| year || tm_year || Year
|-
| wday || tm_wday || Days since Sunday
|-
| yday || tm_yday || Days since January 1
|-
| isdst || tm_isdst || Daylight Saving Time flag
|}
|}


== Examples ==
<syntaxhighlight>localtime(time())->year</syntaxhighlight>


Result: 2012 (integer)
== Return Value ==
 
Object of class [[NXSL:TIME|TIME]].
 


Equivalent:
== Examples ==
<syntaxhighlight>localtime()->year</syntaxhighlight>


Result: 2012 (integer)
localtime(time())->year -> 2012
localtime()->year -> 2012
683

edits