Home  >  Article  >  Backend Development  >  The specific process of formatting time in php

The specific process of formatting time in php

黄舟
黄舟Original
2017-08-16 15:25:521607browse

In our previous lesson, we introduced php to get the example sharing of last Monday, last Sunday, and next Monday. I believe that many friends are familiar with getting the time. Used, then how do we format the time to display it? Today we will introduce to you how to format the time in PHP and convert the timestamp into the number of days, hours, minutes, and seconds ago~

First download the PHP time formatting class library we need to use for this course: http://www.php.cn/xiazai/leiku/709

After the download is complete, find what we need php class file, unzip it to our local directory and create a new php file!

After completion, we need to call this class in the new php file and instantiate the class:

<?php
include_once "codesj.php"; //引入类文件
$obj = new DateFormat;     //实例化类
echo $obj->diff(&#39;999999999&#39;); //输出

?>

Run the file and the result will be as shown below:

The specific process of formatting time in php

The above is the detailed content of The specific process of formatting time in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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