
Xiaohong L. answered 02/19/23
25 Years of Experience in Database Design / SQL / ETL / Reporting
You may write something like this:
SELECT ModifiedDate,
ModifiedDate AT TIME ZONE 'UTC' AT TIME ZONE 'Pacific Standard Time' AS ModifiedDateLocalTime
FROM <TableName>
WHERE ModifiedDate >= CAST('1/1/2023' AS DATETIME) AT TIME ZONE 'Pacific Standard Time' AT TIME ZONE 'UTC'
The WHERE clause above converts the local date 1/1/2023 from the Pacific time zone to UTC (i.e., 1/1/2023 8:00 AM at UTC) and compare it with the UTC value of ModifiedDate.
If the WHERE clause above is changed to:
WHERE ModifiedDate AT TIME ZONE 'UTC' AT TIME ZONE 'Pacific Standard Time' >= '1/1/2023'
The query will return the same result but it's less efficient because every record needs to be converted to the Pacific time zone to compare with 1/1/2023.