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('999999999'); //输出 ?>
Run the file and the result will be as shown below:
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!