Setting the Time Zone in SingleStore
The default_
configuration option can be used to set the time zone by specifying an offset from UTC time.
sdb-admin update-config --key default_time_zone --value "+00:00" --all
And then restart the cluster by running the following command:
sdb-admin restart-node --all
For example, to specify an offset of 01 hour from UTC, run the following command and restart the cluster.
sdb-admin update-config --key default_time_zone --value "+01:00" --all
Note: default_
is a startup configuration option and not engine variable, so you cannot read or write it using the SELECT
or SET
command.
When you set default_
(for example to the value UTC
), then the time_default_
.
SELECT @@TIME_ZONE;
+-------------+
| @@TIME_ZONE |
+-------------+
| UTC |
+-------------+
The actual time zone used by SingleStore is time_
(which is set in default_
).CURRENT_
or LOCALTIMESTAMP()
displays the actual time zone used by SingleStore:
SELECT CURRENT_TIMESTAMP();
+---------------------+
| CURRENT_TIMESTAMP() |
+---------------------+
| 2020-05-26 11:27:56 |
+---------------------+
When you query DATETIME
values, SingleStore displays the timestamp as it was originally entered.default_
setting.
For example, assume that the default_
is set to -4:00
and you insert a DATETIME
value 2020-07-08 15:40:52
.default_
to -7:00
and then query the same DATETIME
value.2020-07-08 15:40:52
.
Last modified: November 6, 2023