Objective
The instantiation object is preceded by the use of the native class in the namespace, and if the namespace is not used, the preceding \ can be deleted
1. Output Current time
$datetime = new \datetime;
Print_r ($datetime->format ('
In this paper, the methods used by the DateTime object are collated to make it easy for us to find and flip through, so we can refer to learning.
Objective
The instantiation object is preceded by \ means that the native class is used in the
Python processes the time and date modules, mainly using the datetime, time, and calendar modules. The following article mainly introduces the datetime module in Python. you can refer to it for reference. let's take a look at it. Preface
Python
Good practice, this time mainly selected some development http://www.php.cn/"target=" _blank ">php application should be used on the good practice of detailed records, especially in good practice part of the password and flow two points. The code
PHP converts the DateTime object to the implementation code of friendly time display. For more information, see.
Copy codeThe code is as follows:
/**
* Friendly date and time
*
* @ Param DateTime $ datetime date and time
* @ Param int $ size precise
Converts datetime to Chinese. The following is a method for converting datetime to adult, month, day, hour, minute, and second. For more information, see. The following is a conversion of datetime date and time to adult \ ', \ 'months \', \ 'Day \ ',
Copy CodeThe code is as follows:
/**
* Friendly Date and time
*
* Date Time @param datetime $datetime
* @param int $size Precise in-place number
* @throws \invalidargumentexception
* @return String
*/
function Friendly_date ($datetime, $size
Convert DateTime object to friendly time display
Convert DateTime objects to friendly time display using DateInterval in PHP 5.x
/**
* Friendly date and time
*
* @ Param DateTime $ datetime date and time
*
Unix epoch Time, also known as POSIX time/epoch time, is the total number of seconds from 0 seconds from January 1, 1970 0:0 UTC to the present, excluding leap seconds. A positive value represents 1970, and a negative value indicates before
Convert a DateTime object to a friendly time display using DateInterval in PHP 5.x
/**
* Friendly Date and time
*
* Date Time @param datetime $datetime
* @param int $size Precise in-place number
* @throws
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.