ezeio2:scriptref:localtime

Split Unixtime into components

Description

localtime(timestamp, local=0, year, month, day, hour, minute, second, weekday, yearday)

Split the timestamp into components.

Parameters

timestamp Unix timestamp (seconds since 1970-01-01, UTC)
local false=result is UTC, true=result is local time
year Will be set to the year
month Will be set to the month
day Will be set to day of month
hour Will be set to the hour
minute Will be set to the minute
second Will be set to the second
weekday Will be set to the day of week (0=Sunday)
yearday Will be set to the day in the year

Return value

Returns the timestamp. The parameters year – yearday are written as described above.

Example usage

 
   new yy, mo, dd, hh, mi, ss;
   new t = GetSystemItem(SYSITEM_EPOCH);
 
   localtime( t, false, yy, mo, dd, hh, mi, ss );  // yy, mo, dd, hh, mi and ss are set to current UTC time.
 

NOTE: First appeared in firmware 22110901

  • ezeio2/scriptref/localtime.txt
  • Last modified: 2022-11-09 19:51
  • by andreh