Sql-server – In the SQL Server RESTORE statement, in what time zone is the STOPAT argument

restoresql servert-sql

SQL Server can perform point-in-time restores using the STOPAT argument. In what time zone is that date and time value?

  • Is it UTC?
  • Is it local for the server the backup was taken?
  • Is it local for the server the backup is restored?

Best Answer

Short Answer: From when the backup was taken

I actually wasn't sure of the answer, so I just made a database, put it in full recovery model, took a full backup, did some work (create a couple tables named after the time I created them) and then started restores. Restored the full and then attempted to apply the log backups.

When I did that I had to specify the time zone from when the changes were made - from when the backup was taken. If I tried to use the new time zone's setting, it errored - bad timing.

So the answer to your question in my experience with SQL Server 2012 and 2008R2 - appears to be "The local time from when the backup was taken"

This backs up my expectation before testing. The way the log records are written and the way the backups are taken - that makes sense.

That said - I can't imagine a ton of situations where the time zone is changing with the need to worry about point in time recovery?