help with the UNIX_TIMESTAMP function in mysql

2

I am using the UNIX_TIMESTAMP function to convert a date to unix format.

The date is this: 2018-04-16 12:00:00

when I use UNIX_TIMESTAMP('2018-04-16 12:00:00');

returns 1524225600 that is equal to 2018-04-16 07:00:00

Why does that happen?

    
asked by skycomputer2 19.04.2018 в 20:14
source

2 answers

1

Because it uses the time in utc, it depends on your time zone.

Add or subtract the necessary time.

    
answered by 19.04.2018 / 20:18
source
3

UNIX_TIMESTAMP always returns time in UTC format. If you want to use it, you would have to do the manual conversion of your local time to UTC.

    
answered by 19.04.2018 в 20:17