Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.
Komentár: parameter timeZone

%AddIntervalLocal function


Function
The function adds relative time TimeR to absolute time TimeA. A result is value of Absolute time type.
Declaration


Blok kódu
languageesl
themeConfluence
TIME %AddIntervalLocal(
   TIME in TimeA,
   REAL in TimeR,
   INT TEXT in timeZone :=  %GetTimeZone%GetCurrentTimeZone()
 )


Parameters


TimeAAbsolute time.
TimeRRelative time.
timeZone
Forced
Name of the time zone used for conversion to
convert to a
local time
. It is set as a time zone offset from UTC during winter in seconds.
(e.g. "Europe/London") or definition of fixed offset from UTC using format "(+|-)hh[:mi[:ss]]", where hh defines number of hours, mi defines number of minutes, and ss defines number of seconds. Sign as well as number of hours are mandatory parts of offset definition, number of minutes and seconds are optional and default to 0 (e.g. "+02:30" defines offset of 2 hours and 30 minutes from UTC). Empty text has the same meaning as function %GetCurrentTimeZone.
Note: For historical reasons, integer parameter is also accepted. Its interpretation is as follows: 0 - zone "Europe/London", 3600 - zone "Europe/Bratislava", 7200 - zone "Europe/Kiev", 21600 - zone "Asia/Almaty". Usage of integer parameter is deprecated and generates warning into log file!


Description
The function %AddIntervalLocal adds relative time to absolute one. The result will not be influenced by the fact if the time offset was or was not in this interval. E.g., if 3 hours are added to 1:00 a.m., the result is always 4:00 a.m.
Example


Blok kódu
languageesl
themeRDark
 ; =================================================================
;  Using time zone "Europe/Bratislava"
;  Daylight saving time  Slovakia (country for this example)
 ;  Time zone is UTC+1.
 ;  There arewas observed in year 2009, therefore time shifts occured.
;  Winter [B] time was 1 hour ahead of UTC, summer [A] andtime winterwas [B]2 timehours (withahead timeof shifts)UTC.
 ;  Summer time iswas from 29th March 2009 to 24th October 2009.
 ;  A3:00:00 is changed to B2:00:00 on Sunday (25th October 2009).
 ; =================================================================
 
 
 BEGIN
 
  TIME _baseTime
 
  TIME _addLocal1
  TIME _addLocal2
 
   ; UTC2009-10-24 23:30:00 24.10.2009UTC / 2009-10-25 01:30:00 UTC+02
  _baseTime := %StrToTimeEx("2009-10-25 01:30:00 25.10.2009", "yyyy-mm-dd hh:mi:ss dd-mm-rrrr", "Europe/Bratislava")
 
  ; add 1 hour - result time 252009-10-200925 A2:30:00.000 UTC+02
  _addLocal1 := %AddIntervalLocal(_baseTime, 3600, "Europe/Bratislava")
  ; add 2 hour - result time 252009-10-200925 03:30:00.000 UTC+01
  _addLocal2 := %AddIntervalLocal(_baseTime, 7200)
 
 END
 , "Europe/Bratislava")
END