D
D
DTX2016-03-03 23:13:24
MySQL
DTX, 2016-03-03 23:13:24

MySQL. How to get UTC timestamp from datetime column?

  1. The timezone on the server is set to GMT-7 and there is no way to change it.
  2. I have a DateTime column that contains "2016-03-03"
  3. You need to get a timestamp, assuming that the column contains the time in UTC.

UNIX_TIMESTAMP returns 1456963200 instead of 1456988400 (difference 25200 = 7 hours).
How to decide?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2016-03-03
@Rsa97

UNIX_TIMESTAMP(DateTime)+7*3600

I
Igor, 2016-03-03
@unitby

UNIX_TIMESTAMP(CONVERT_TZ())
and any

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question