php - Should different servers translate unix timestamps as different dates? -


While working on a UI update for a customer, I noticed that the dates associated with all articles were outside of one day. I thought I had spoiled some things during my changes, but to ensure that, throwing out a small PHP test file that gave me some strange results. The test file is just;

  & lt ;? Php $ date = 1246053600; Echo 'Unix:', $ date, ', changed:', date ('d / m / y', $ date); ? & Gt;  

If I run the above code on my local host, then I get:

Unix: 1246053600, converted: 26/06/2009

But if I run it on a production server:

Unix: 1246053600, converted: 27/06/2009

What is the difference between notice? What's going on here?! Definitely there is no server-specific dependency to convert a Unix timestamp to a date?

Your servers set in two different time zones, and they were midnight January 1, 1970 Since GMT are interpreting the timestamp as the number of seconds. Dates can not be closed all day, but just one part of a day, it is enough to cross the midnight limit.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -