PHP Convert Seconds to time (year, month, day, hour ...) The Code

Source: Internet
Author: User
wrote a function that converts the events represented by the number of seconds to the time format of year, month, day, and hour. If you need a friend, you can refer to it below. The

Code is as follows:

 0, "days" = 0, "hours" = 0, "Minu     TEs "= 0," seconds "= 0,);       if ($time >= 31556926) {$value ["years"] = Floor ($time/31556926);     $time = ($time%31556926);       if ($time >= 86400) {$value [' days '] = floor ($time/86400);     $time = ($time%86400);       if ($time >= 3600) {$value ["hours"] = floor ($time/3600);     $time = ($time%3600);       if ($time >=) {$value ["minutes"] = floor ($time/60);     $time = ($time%60);     } $value ["seconds"] = floor ($time);   Return (array) $value;   }else{return (bool) FALSE; }}?> 
  • 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.