Difference between revisions of "NXSL:localtime"

From NetXMS Wiki
Jump to navigation Jump to search
(Created page with "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 cur...")
 
m (Text replacement - "^" to "{{deprecated}}")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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:
{{deprecated}}__NOTOC__
{| class="wikitable"
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.
 
 
== Syntax ==
 
localtime(''time'');
 
 
== Parameters ==
 
:{|
|-
|-
! Attribute !! Synonym !! Meaning
| ''time'' || Time as seconds since epoch (1 January 1970 00:00:00 UTC). If omitted, current time is used.
|-
| sec || tm_sec || Seconds after the minute
|-
| 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  
|-
| year || tm_year || Year
|-
| wday || tm_wday || Days since Sunday
|-
| yday || tm_yday || Days since January 1
|-
| isdst || tm_isdst || Daylight Saving Time flag
|}
|}
== Return Value ==
Object of class [[NXSL:TIME|TIME]].


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


Result: 2012</syntaxhighlight>
localtime(time())->year -> 2012
localtime()->year -> 2012

Latest revision as of 16:13, 13 September 2022

This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

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.


Syntax

localtime(time);


Parameters

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


Return Value

Object of class TIME.


Examples

localtime(time())->year		->	2012
localtime()->year		->	2012