←back to thread

189 points GordonS | 8 comments | | HN request time: 0.386s | source | bottom
1. cpeterso ◴[] No.19532799[source]
What timestamp types are available in MySQL, SQL Server, and Oracle?
replies(5): >>19532853 #>>19532902 #>>19533224 #>>19533575 #>>19533819 #
2. tyingq ◴[] No.19532853[source]
Be careful with the MySQL ones. A couple of them overflow past 1-1-2038, which would break some use cases now. https://bugs.mysql.com/bug.php?id=12654
3. ◴[] No.19532902[source]
4. emmelaich ◴[] No.19533224[source]
Dunno but sqlite3 assumes times are in utc.
5. userbinator ◴[] No.19533575[source]
SQL Server has datetimeoffset, which computes in UTC but also stores the timezone.
replies(1): >>19534190 #
6. niftich ◴[] No.19533819[source]
Oracle has 'DATE', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE', and 'TIMESTAMP WITH LOCAL TIME ZONE'.

Out of these, 'TIMESTAMP' and 'TIMESTAMP WITH TIME ZONE' do exactly what you'd expect without needing a big tutorial.

'DATE' is a 'TIMESTAMP' that can't store fractional seconds.

And 'TIMESTAMP WITH LOCAL TIMEZONE' is an unmitigated footgun that you'll probably misuse.

7. crooked-v ◴[] No.19534190[source]
Does it store the time zone, or does it store the offset?
replies(1): >>19535099 #
8. GordonS ◴[] No.19535099{3}[source]
AFAIK, it stores the offset