March 13, 2016 This day is not equal to 3600*24 seconds?

Source: Internet
Author: User
Find a bug in your job:

My company server PHP default timezone and timezone are configured to America/los_angeles;

Time Stamp 1457856000,

Formatted with the date () function is 2016-03-13 00:00:00;

But after adding 3600*24-1 seconds to the timestamp, the date () function was used to format the discovery as the 2016-03-14 00:59:59;

The day before and after the date did not have such a strange phenomenon;

Does anyone know why?

Reply content:

Find a bug in your job:

My company server PHP default timezone and timezone are configured to America/los_angeles;

Time Stamp 1457856000,

Formatted with the date () function is 2016-03-13 00:00:00;

But after adding 3600*24-1 seconds to the timestamp, the date () function was used to format the discovery as the 2016-03-14 00:59:59;

The day before and after the date did not have such a strange phenomenon;

Does anyone know why?

/** * 按照你说的时间,应该就是这个时区, * 但是没什么问题,是你的计算过程出现什么没有注意到的地方, 还是不同的时区的关系 */date_default_timezone_set('Etc/GMT+8');$timeStamp = 1457856000;var_dump(date('Y-m-d H:i:s', $timeStamp));var_dump(date('Y-m-d H:i:s', $timeStamp + 3600*24-1));

Not very understanding of your problem ... The initial suspicion is due to other calculations.

There is a concept called Daylight saving time ~

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.