The function returns the serial number of the week of given absolute time.
Declaration
INT %WeekNr(
TIME in Time,
TEXT in timeZone := %GetCurrentTimeZone()
)
Parameters
Time
Function argument.
timeZone
Name of the time zone used for conversion to local time (e.g. "Europe/London") or definition of fixed offset from UTC using format "(+|-)hh[:mi[:ss]]", where hh defines a number of hours, mi defines a number of minutes, and ss defines a number of seconds. Sign as well as a 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). The empty text has the same meaning as function %GetCurrentTimeZone. Note: For historical reasons, an 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!
Example
%WeekNr(SysTime) ; result is the serial number of the current week
Note
For the date of January 1st, the function returns the value of 1. For the last week of a year and the first week of the next year, the function returns different values although the weeks could be the same in the calendar.
To avoid this difference, we recommend you to use the function %WeekOfYear.