VBScript → Lua
This function returns the current date and time according to the script user's location.
Dim vDateTime vDateTime = CurDateTime()
or if being used directly within a GSE property dialog, e.g. in a Say Date block to directly announce the current date to the caller:
This function is not the same as the VBScript build in function Now.
While Now returns the current date and time of the SwyxWare Service Account Windows User (according it's regional settings) when being used within a call routing script, CurDateTime() uses the Server Script API function PBXUser.Now to get the script user's date and time according to his location (timezone) configuration within SwyxWare. This is not necessarily the same.
The SwyxWare Service Account is the Windows User the SwyxWare Services are running under. As call routing scripts are executed by the SwyxServer Service they use the SwyxWare Service Account configuration.
If you prefer using the VBScript build in Now function in favour of CurDateTime() in multi-location environments spreaded over several time zones, you can use SetLocale to adjust the regional settings for the current script. This is just for the current instance of the script and is not permanent on the server.
Assuming you have a location in Germany and one in New Zealand. The server is located in Germany. Users from New Zealand are logged in via a direct VPN connection. The server uses a German operating system as also complete German regional settings. Before using Now you need to set the correct locale in order to receive the correct date / time for New Zealand:
SetLocale = 5129 ' New Zealand Dim vDate vDate = Now