PHP converts MySQL datetime to Unix Timestamp

I am confused about the differences in time zones when converting MySQL date and time to a Unix timestamp. It seems to me that MySQL datetimes ( 2011-02-07 09:45:00 ) is in the local time zone of the server. I want to convert this datetime to a Unix timestamp, which is always in GMT timezone. To do this conversion, PHP passes the date and time to strtotime . The datetime string does not contain a time zone, so strtotime suppose the argument is a local time zone or GMT?

+4
source share
2 answers

The strtotime function will assume that the datetime is in the local time zone of the server.

+5
source

Why not use the MySQL UNIX_TIMESTAMP () function?

+1
source

Source: https://habr.com/ru/post/1338313/


All Articles