PHP Get system Boot Time instance code _php tutorial

Source: Internet
Author: User
PHP Gets the system startup time and length instance code

    1. System startup time calculation.
    2. $UPTIME = 32936982.68;
    3. $DAY = Floor (($UPTIME/86400) *1.0);
    4. $cal _day = $DAY * 86400;
    5. $cal _hour = $UPTIME-$cal _day;
    6. $hour = Floor (($cal _hour/3600) *1.0);
    7. if ($hour < 10) {
    8. $hour = "0". $hour;
    9. }
    10. $cal _tmp = $hour * 3600;
    11. $cal _min = $cal _hour-$cal _tmp;
    12. $min = Floor (($cal _min/60) *1.0);
    13. if ($min < 10) {
    14. $min = "0". $min;
    15. }
    16. $cal _sec = $min * 60;
    17. $sec = Floor (($cal _min-$cal _sec) *1.0);
    18. if ($min < 10) {
    19. $sec = "0". $sec;
    20. }
    21. $ServerUptime = $DAY. "Day,". $hour. ":". $min. ":". $sec;
    22. echo result output:. $ServerUptime;
    23. ?>

Result output: 381 days, 05:09:042

http://www.bkjia.com/PHPjc/486140.html www.bkjia.com true http://www.bkjia.com/PHPjc/486140.html techarticle PHP Gets the system boot Time instance code? PHP//System startup time calculation. $UPTIME = 32936982.68; $DAY = Floor (($UPTIME/86400) *1.0); $cal _day = $DAY * 8640 0; $cal _hour = $UP ...

  • 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.