bbnn
bbnn

Reputation: 3612

Does UNIX time record Timezone?

I want to ask about UNIX time, Does UNIX time record Timezone?

I moved my hosting from Chicago/America to JST.

The problem is that my whole MySQL database has records of UNIX time (Chicago/America timezone)

I have a PHP code to show the time ago (ex 3days ago, yesterday, etc) When I move to the new server it says tomorrow

To avoid this tomorrow, is it ok to make the server down for one day in order to synchronize with the current server's timezone?

I worry that the UNIX time doesn't only record the date and time, but also the timezone...

I can set the PHP.ini timezone, but will it slowdown my Apache?

Upvotes: 3

Views: 3224

Answers (3)

POSIX 7 defines it as (emphasis mine):

If the year is >=1970 and the value is non-negative, the value is related to a Coordinated Universal Time name according to the C-language expression, where tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all integer types:

tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
(tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400

So it is always relative to UTC, and thus does not encode timezone information.

Taught to me by: https://stackoverflow.com/a/20035913/895245

Upvotes: -1

Amy B
Amy B

Reputation: 17977

"0" in UNIX time was 1st January 1970 in UTC time. Every UNIX time is the seconds from that date, time, and timezone.

Upvotes: 5

Ben Reisner
Ben Reisner

Reputation: 662

'unix time' is the number of milliseconds from the epoch, which is standard for all of our planet Earth. the timezone is then used as a modifier to that time.

Upvotes: 1

Related Questions