All Questions
21 questions
0
votes
1
answer
2k
views
Postgres changing data type from timestamp to timestamptz (with time zone)
I recognize there are some similar questions, and I've read quite a few, so pardon me if I just missed the answer.
I have data that was stored as a TIMESTAMP data type, but now we want it to be stored ...
0
votes
1
answer
2k
views
Does changing server time zone "shift" SQL Server stored date / time values in ODBC / JDBC?
I've read that SQL Server:
uses system time zone on Windows (reg key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\TimeZoneKeyName)
uses TZ env var on Linux or /etc/timezone....
3
votes
2
answers
3k
views
Retrieving the local timezone inside SQLite
I have an SQLite table containing a "last changed" column with a date in the format e.g. "2022-11-07T11:51:06+01:00". Coreutils' date outputs this by using the following command:
...
3
votes
1
answer
10k
views
How to query dates in different timezones?
I have a table and index in a PostgreSQL 10.18 database:
CREATE TABLE some_table (
expires_at timestamptz
);
CREATE INDEX ON some_table(expires_at);
Is there a way to write this query in a way to ...
7
votes
2
answers
11k
views
Why is GetDate AND GETDATE() AT TIME ZONE 'GMT Standard Time' returning the wrong time?
Please see the code below:
DECLARE @UKDateTime as DateTime
SELECT @UKDateTime = GETDATE() AT TIME ZONE 'GMT Standard Time'
print @UKDateTime
PRINT GETDATE()
This returns:
Oct 4 2021 4:03PM
Oct 4 ...
7
votes
1
answer
4k
views
SQL Server 2012 equivalent of AT TIME ZONE capability
Is there a way in SQL Server 2012 to get what the server time zone would be on a particular date/time? In SQL Server 2016, you have AT TIME ZONE, but that's not available in 2012. I have a ...
0
votes
0
answers
2k
views
Compare datetimes with dfferent timezones in MySQL
I have a field `opened_at` in MySQL table that stores datetimes in string format with different timezones:
2021-01-30T18:07:40+02:00
2021-01-31T01:32:40+05:00
2021-01-31T21:17:40+03:00
etc.
I need to ...
1
vote
1
answer
2k
views
Update record with converted epoch timestamp from another column
I'm trying to convert epoch data in one column (timestamp_epoch) to a legitimate timestamp in another column (timestamp) for every record in a table. In reading the PostgreSQL Documentation it ...
0
votes
1
answer
1k
views
Disable mysql_tzinfo_to_sql during MariaDB/MySQL installation
MariaDB run in docker container hangs during initial startup while mysql_tzinfo_to_sql running because of the issue.
I've disabled mysql_tzinfo_to_sql by setting MYSQL_INITDB_SKIP_TZINFO env. var to ...
0
votes
1
answer
1k
views
how to ignore DST in MySQL
We have a database with flights, and in there, departureTime DATETIME field.
Extra info:
global.time_zone: Europe/Dublin
session.time_zone: Europe/Dublin
MySQL version: 5.7
Problem is, I need to ...
18
votes
1
answer
45k
views
How do I generate a date series in PostgreSQL?
If you're looking to generate a time series, see this question
Let's say that I want to generate a series of dates between two dates.
I see the function generate_series provides only
Function ...
5
votes
2
answers
10k
views
SQL Server 2014 accounts for Daylight Saving Time now?
My computer/SQL Server 2014 uses Eastern Time Zone which is 5 hours behind UTC time. But when I run the following code, I get a 4-hour difference.
CREATE TABLE datetimeoffsetfunction(
...
1
vote
1
answer
1k
views
Querying dates with different timezones at db and application level
There is a created_at column of datetime type in the order table. In my application I'm storing dates to the db as datetime in UTC. When I bring them back from the db I'm presenting/formating them to ...
1
vote
1
answer
6k
views
Converting UTC time to timestamptz always adds the +01 offset in Postgres
In Postgres 9.5, I do the following to convert a timestamptz to the UTC timezone:
SELECT TIMESTAMP WITH TIME ZONE '2016-02-20 15:15:54.000495+01' AT TIME ZONE 'UTC'
this outputs correctly 2016-02-20 ...
4
votes
1
answer
10k
views
mysqldump between servers with different timezones (tz-utc)
If I am moving databases between servers datetime/timestamp fields with different timezones; I have been doing:
mysqldump --tz-utc=false database_name;
then reloading it on the server with different ...
0
votes
1
answer
1k
views
Filter column by records matching a timezone in Postgres
I want to check whether any rows in my column (TIMESTAMP WITH TIME ZONE) are not stored using UTC. Is there a query I can write to match values that are stored with a TZ offset of 1 or 8 or 11 or (not ...
1
vote
0
answers
512
views
mysql datetime timezone +0000
I've got a Twitter database and some columns in multiple tables are time-stamps like:
Tue Sep 09 23:48:37 +0000 2014
These columns are TEXT so I want to convert them. I read
Date and Time Types,
...
1
vote
1
answer
2k
views
Format timezone to +-#### instead of +-##
I am curious if there is a way to configure Postgres (9.1+) to format the TZ part of a "timestamp with time zone" as +-####, just like PHP's date.format method does using "O".
PHP Docs:
O | ...
4
votes
1
answer
6k
views
How does Sybase store datetime information?
We have a Sybase database that currently stores datetime values in some of the tables. If we move that server with the Sybase database to another country which is in another time zone, will the ...
2
votes
2
answers
1k
views
SQL Server and SharePoint time problem
I have created a SharePoint application which has a specific time zone.
The Windows server where SQL Server and SharePoint are installed are using same time zone.
When I create a new item in list ...
14
votes
2
answers
10k
views
Handling time zones in data mart/warehouse
We are starting to design the building blocks of a data mart/warehouse and we need to be able to support all time zones (our clients are from all over the world). From reading discussions online (and ...