Convert AD pwdLastSet to Datetime

SELECT dateadd(day,90,CONVERT(DATETIME, (132314568622602434 / 864000000000)- 109207 ))  

https://www.sqlservercentral.com/forums/topic/convert-nanoseconds-since-111601  

AD pwdLastSet within 90 days

SELECT dateadd(d,90,Dateadd(hh, Datediff(hh, Getutcdate(), Getdate()), CONVERT(DATETIME, (pwdLastSet / 864000000000)- 109207 ))),* from master.dbo.addata where pwdLastSet > 0  


Get Local Time with GETDATE()

select Dateadd(hh, Datediff(hh, Getutcdate(), Getdate()), CONVERT(DATETIME, (132314568622602434 / 864000000000)- 109207 ))

https://www.got-it.ai/solutions/sqlquerychat/sql-help/data-query/how-to-convert-utc-to-local-time-conversion-in-sql-server/