faaTZgetdate
- Last UpdatedMar 18, 2021
- 1 minute read
Returns the date/time, in the appropriate time zone.
Syntax
SELECT dbo.faaTZgetdate(TimeZone)
Arguments
TimeZone
The name of the time zone.
Return Type
nvarchar(100).
Remarks
Use this function instead of the SQL GetDate() function to specify a time zone other than the server time zone in a query. To retrieve data in the time zone of the server, just use the SQL GetDate() function.
Example
DECLARE @starttime datetime
SET @starttime = dbo.faaTZgetdate('eastern daylight time')
SELECT DateTime, TagName, Value FROM History
WHERE TagName IN ('SysTimeHour', 'SysTimeMin', 'SysTimeSec')
AND DateTime > DateAdd(mi, -30, @starttime)
AND DateTime < DateAdd(mi, -5, @starttime)
AND wwTimeZone = 'eastern daylight time'
For more information on using date/time functions in a query, see Use DateTime functions in the AVEVA Historian Concepts Guide.