On Mon, Feb 3, 2020 at 3:01 PM Rob Berendt <rob@xxxxxxxxx> wrote:
This had me thinking about current_timezone again.
If I run
Values current_timezone;
On IBM i I will get back something like -50000 during Eastern Standard Time and -40000 during Eastern Daylight Time.
What does SQL server return? Will it vary according to the time of the year or is it something you just have to know to adjust? What I'm reading is this:
https://docs.microsoft.com/en-us/sql/t-sql/functions/current-timezone-transact-sql?view=sql-server-ver15
I don't know why it is you cannot seem to ever grasp this.
It does not vary according to the time of year, but also, you do NOT
have to adjust it. You are *not supposed* to adjust it. Indeed, you
*cannot* adjust it without destroying the instance and recreating it.
The *time zone* does not change for daylight time, no matter whether
your locality observes daylight time or not. Essentially, a time zone
is a geographic area. The lines and rules are drawn by governments,
and could change. But in a stable political environment, this is rare.
The *UTC offset* is a real-time thing which changes depending on
whether you are *actively observing* daylight time or not.
The thing in parentheses at the beginning of a *display name* for a
time zone (which is what the Microsoft docs are talking about) is just
for geographical sorting purposes. (It is much easier to find your
time zone if the choices are sorted (approximately) by longitude
rather than sorted alphabetically.) That display name still refers to
a *time zone* and does NOT refer to a (real-time) UTC offset.
I'll grant that it sure *looks like* a UTC offset, but this is one of
those "user friendliness" things. The more rigorous way to sort time
zones (again, I cannot stress enough, these are geographic areas)
would be to really use longitudes; but by and large, people don't know
those. What they are comfortable working with are UTC offsets. Since
"standard time" offsets are more reliable than "daylight time" offsets
(especially given that not everywhere even has daylight time), they
just include the standard time offset in the display name.
John Y.
As an Amazon Associate we earn from qualifying purchases.