Home Backend Development PHP Tutorial PHP把秒(非时间戳)转化成钟头和分

PHP把秒(非时间戳)转化成钟头和分

Jun 13, 2016 pm 01:04 PM
function gt nbsp sec this

PHP把秒(非时间戳)转化成小时和分
PHP Code网站建设:http://www.ucantech.com/

    //将秒(非时间戳)转化成 ** 小时 ** 分 
    function sec2time($sec){ 
     
     $sec = round($sec/60); 
     if ($sec >= 60){ 
      $hour = floor($sec/60); 
      $min = $sec%60; 
      $res = $hour.' 小时 '; 
      $min != 0  &&  $res .= $min.' 分'; 
     }else{ 
      $res = $sec.' 分钟'; 
     } 
     return $res; 
    } 

时间转换成天小时分秒
PHP Code复制内容到剪贴板

         
    class FormatSeconds 
    { 
        var $days; 
        var $hours; 
        var $minutes; 
        var $seconds; 
     
        function getDays() 
        { 
            return $this->days;         
        } 
        function getHours() 
        { 
            return $this->hours; 
        } 
        function getMinutes() 
        { 
            return $this->minutes; 
        } 
        function getSeconds() 
        { 
            return $this->seconds; 
        } 
     
        function FormatSeconds($sec) 
        { 
            $this->days = floor($sec / (24*3600)); 
            $sec = $sec % (24*3600); 
            $this->hours = floor($sec / 3600); 
            $remainSeconds = $sec % 3600; 
            $this->minutes = floor($remainSeconds / 60); 
            $this->seconds = intval($sec - $this->hours * 3600 - $this->minutes * 60); 
        } 
    } 
     
    $fs = new FormatSeconds(360000); 
    print $fs->getDays(); 
    print " "; 
    print $fs->getHours(); 
    print " "; 
    print $fs->getMinutes(); 
    print " ";  (fblww-0110)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SEC seeks $5.3 billion fine against Terraform Labs and Do Kwon SEC seeks $5.3 billion fine against Terraform Labs and Do Kwon Apr 24, 2024 pm 03:25 PM

The agency is also seeking conduct-based and "compliance with the law" injunctions. The U.S. Securities and Exchange Commission (SEC) wants to fine Terraform Labs and its former CEO DoKwon nearly $5.3 billion for violations of U.S. securities laws and fraud charges. The agency detailed its requested fine in an April 19 legal filing. The SEC is primarily seeking $4.2 billion in disgorgement and $545.7 million in prejudgment interest. The purpose of the illegally obtained proceeds is to force TerraformLabs and Kwon to return the unfair benefits they obtained between June 2021 and May 2022 through the following channels: first, selling tokens to institutional investors; second, through their relationship with Genesi

The U.S. spot ETH ETF listing plan is postponed, and the SEC requires a revised S-1 form to be submitted before July 8 The U.S. spot ETH ETF listing plan is postponed, and the SEC requires a revised S-1 form to be submitted before July 8 Jun 30, 2024 pm 08:38 PM

U.S. Spot Ethereum ETF Launch Delayed The U.S. Securities and Exchange Commission (SEC) has delayed the launch of its spot Ethereum exchange-traded fund (ETH ETF) and required issuers to resubmit Form S-1 before July 8. This decision has resulted in the postponement of the planned launch on July 2, with the new launch expected to be in mid-July or later. Background Overview There has been a change in the review process for spot Ethereum ETFs, with Bloomberg’s senior ETF analyst Eric Balchunas commenting on the SEC’s latest decision and its impact on market expectations. Earlier last month, SEC Chairman Gary Gensler

The SEC Temporarily Suspends Its Allegations That SOL, ADA, and MATIC Are Unregistered Securities The SEC Temporarily Suspends Its Allegations That SOL, ADA, and MATIC Are Unregistered Securities Jul 31, 2024 am 12:25 AM

This decision comes amid the ongoing legal proceedings against Binance, one of the world's leading cryptocurrency exchanges.

In this article, learn about SEC and Fidelity talking about open staking for crypto ETFs! Discussing ETF staking, stablecoins and DeFi regulation In this article, learn about SEC and Fidelity talking about open staking for crypto ETFs! Discussing ETF staking, stablecoins and DeFi regulation Mar 04, 2025 am 11:09 AM

The minutes recently released by the Securities and Exchange Commission (SEC) show that the SEC Cryptocurrency Working Group (CTF) has held talks with Fidelity Investment and MITRE to discuss many key issues in crypto asset regulation. SEC and Fidelity: Pledge of crypto ETFs and related rules At this meeting, SEC and asset management giant Fidelity had in-depth exchanges on the issue of crypto asset supervision. Discussions cover: Customer protection rules related to brokerage dealers' interaction with digital asset securities (Rule15c3-3). Formulate standardized listing rules for digital asset exchange-traded products (ETPs). Clarify ETF pledged assets and operating specifications. Monitoring of blockchain tokens and financial instrument-related rewards (such as pledge income, liquidity mining)

Why Cancelled SEC vs Ripple Meeting Shouldn't Worry XRP Holders Why Cancelled SEC vs Ripple Meeting Shouldn't Worry XRP Holders Aug 01, 2024 pm 10:02 PM

The U.S. Securities and Exchange Commission (SEC) has cancelled a closed-door meeting that was initially scheduled for today at 2 PM Washington time.

Source: SEC is very interested in staking! Or promote the revival of Ethereum? Source: SEC is very interested in staking! Or promote the revival of Ethereum? Mar 04, 2025 am 09:57 AM

The U.S. Securities and Exchange Commission approved the Ethereum spot ETF in July last year, but its performance was worse than expected. One reason is that traditional institutions have limited understanding of Ethereum, and more importantly, existing Ethereum spot ETFs have failed to fully utilize their advantages - open staking to obtain stable returns. However, according to a message posted on social media X by ETFStore President Nate Geraci, the SEC has confirmed the 19b-4 application for staking of 21 SharesCoreEthereum ETF submitted by Cboe. SEC is very interested in the pledge mechanism Fox Business News reporter Eleanor Terrett quoted sources as saying that the SEC is currently very concerned about the pledge mechanism and has even asked the industry to

The SEC No Longer Asks the Court to Deem the Tokens Named in Its Lawsuit against Binance as Securities The SEC No Longer Asks the Court to Deem the Tokens Named in Its Lawsuit against Binance as Securities Jul 30, 2024 pm 06:29 PM

The United States Securities and Exchange Commission (SEC) no longer asks the court to decide and deem the tokens named in its lawsuit against the crypto exchange

SEC sets up a new department CETU! Targeted to combat AI fraud, blockchain and cryptocurrency crimes SEC sets up a new department CETU! Targeted to combat AI fraud, blockchain and cryptocurrency crimes Mar 04, 2025 am 11:54 AM

The Securities and Exchange Commission (SEC) officially launched the "Cyber ​​and Emerging Technology Division" (CETU) on February 20, 2025, aiming to combat cybersecurity-related violations and protect investors from fraud in emerging technology fields. The department, led by Laura D'Allaird, integrates resources from the original crypto assets and networking department and brings together about 30 experts from various SEC departments. SEC Acting Chairman Mark T.Uyeda said that CETU will work with the cryptoasset task force to ensure the effective allocation of law enforcement resources, with the goal of protecting investors, promoting capital formation, maintaining market efficiency, and supporting innovative and healthy development. CETU focuses on combating areas: artificial intelligence fraud, social media fraud, blockchain

See all articles