Questions tagged [utc-time]
12 questions
50
votes
6 answers
MySQL Set UTC time as default timestamp
How do I set a timestamp column whose default value is the current UTC time?
MySQL uses UTC_TIMESTAMP() function for UTC timestamp:
mysql> SELECT UTC_TIMESTAMP();
+---------------------+
| UTC_TIMESTAMP() |
+---------------------+
| 2012-07-01…
Adam Matan
- 12,079
- 30
- 82
- 96
39
votes
2 answers
How to best store a timestamp in PostgreSQL?
I'm working on a PostgreSQL DB design and I am wondering how best to store timestamps.
Assumptions
Users in different timezones will use the database for all CRUD functions.
I have looked at 2 options:
timestamp NOT NULL DEFAULT (now() AT TIME ZONE…
Bam
- 579
- 1
- 5
- 10
35
votes
11 answers
How can I get the correct offset between UTC and local times for a date that is before or after DST?
I currently use the following to get a local datetime from a UTC datetime:
SET @offset = DateDiff(minute, GetUTCDate(), GetDate())
SET @localDateTime = DateAdd(minute, @offset, @utcDateTime)
My problem is that if daylight savings time occurs…
Rachel
- 8,547
- 20
- 51
- 74
11
votes
1 answer
Oddities with AT TIME ZONE and UTC offsets
I don't understand the difference between these two columns. America/Chicago timezone is UTC-6, so I expect both to return the same result:
select timezone('America/Chicago', '2017-01-01 12:00:00'::TIMESTAMP AT TIME ZONE 'UTC'),
…
Asaf David
- 245
- 2
- 7
2
votes
1 answer
WorldWide site - should I save UTC or in fixed time?
Let's say I have a world wide website ( I mean it has uses from all around the world).
I have 1 server which is in germany ( at some city). it will never be moved from germany - ever.
My question is :
When users saves data , I need to save the…
Royi Namir
- 1,233
- 3
- 13
- 26
2
votes
1 answer
Compute Leap Seconds
I use PostgreSQL 11 and have two columns. One is unix timestamp which is not aware of leap seconds and an utc timestamp which is aware of leap seconds.
Is there a way either to find the number of leap seconds between an unix timestamp (without leap…
nali
- 206
- 2
- 10
1
vote
2 answers
Get time format in PostgreSQL
If I want get Ubuntu system time, I have two options:
$ cat /etc/timezone
US/Eastern
$ date
Sun Sep 15 14:45:02 EDT 2013
How can I find out if PostgreSQL is using utc or a utc offset, such as US/Eastern?
JohnMerlino
- 1,939
- 5
- 20
- 21
1
vote
1 answer
Why is Oracle's TZ_OFFSET wrong for all cities on only one server?
Why does Oracle think that the timezone offset of Denver is UTC-7:00?
The server time and systimestamp look right.
Server 1: Oracle 11.2.0.4.0
SELECT SESSIONTIMEZONE FROM DUAL;
America/Denver
cat /etc/sysconfig/clock
…
Charles Burns
- 251
- 2
- 9
0
votes
1 answer
Query MST instead of UTC for timestamps
on SQL Server, i'm trying to query all of last months data based off of the time stamp, however, all those timestamps are in UTC and i need them to be in MST (the reason is mainly for the end dates)
So far this is what I have:
Select…
scaborski
- 3
- 4
0
votes
0 answers
Relationship between /etc/localtime and Etc/UTC in PostgreSQL
I run our company's DBMS in containers, and when creating a container, the ansible deployment role mounts the host file /etc/localtime along the same path into the container (although, as far as I understand, the behavior would be the same if the…
strafer
- 1
- 1
0
votes
2 answers
UTC time showing wrong
UTC time is showing incorrectly in mysql 5.1. currently, it is 9 AM
mysql> SELECT UTC_TIMESTAMP, UTC_TIMESTAMP( );
+---------------------+---------------------+
| UTC_TIMESTAMP | UTC_TIMESTAMP( ) …
Siva
- 101
- 3
0
votes
1 answer
convert historic local time to UTC taking into account of daylight saving
How should I convert historic local time to UTC taking into account of daylight saving?
The main problem is the daylight saving doesn't occur at a fixed period every year and hence I cannot think of a way to do this task.
Prashant Bhanarkar
- 143
- 5