Solution: Echo strtotime (' 2013-01-01 11:11:11 ') different machine results? What to do with it

Source: Internet
Author: User
Tags echo date
Solution: Echo strtotime (' 2013-01-01 11:11:11 ') Different machine results differ??
This post was last edited by r9000_com on 2013-03-20 10:33:24

The same two lines of code,

echo $ts = ' 2013-01-01 11:11:11 '; Echo '
";
echo Strtotime ($ts);
?>


Running on a Linux server, the result is this:

2013-01-01 11:11:11
1357009871000

But when I run on this machine, the timestamp is the other one, what's going on?
The time zone on the server is set to "asia/chongqing" and the date output is correct under Linux, which is strange. time Stamp Strtotime PHP Time Zone


------Solution--------------------
echo Date ("Y-m-d h:i:s", 1357009871);
echo Date ("Y-m-d h:i:s", 1357038671);

2013-01-01 03:11:11
2013-01-01 11:11:11

After eight hours, there must be a problem with the time zone setting.

Reference:
Reference: The time zone of the two servers is different?
Plus, why multiply by 1000? This date, under PHP is the number of seconds, JS is the number of milliseconds.

Time zone is the same, *1000 is to turn into JS timestamp

------Solution--------------------
3,600 seconds, not hard to imagine
  • 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.