Processing date and time need to consider many things, such as the format of the date, time zone, leap year and days of different months, processing too easily error, we should use the PHP 5.2.0 introduced datetime, Dateintervel and Datetimezone
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
[Best Practices Series] PHP date, time and time zone Processing API and component processing date and time need to consider a lot of things, such as the date format, time zone, leap year and days of different months, self-processing is too
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 ('
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
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
Runtime ConfigurationThe behavior of the Date/time function is affected by the settings in php.ini:
name
Description
default
PHP version
Date.timezone
Specify the default time zone (all Date/time
This article describes how to use PHP to calculate instances of all months in the last year. It has good reference value. Next, let's take a look at the example of PHP computing for all months in the last year. It has good reference value. Let's
How can we calculate a time point plus a long time? for example, if a video is released at 22:50:00 and the total length of time is 01:40:00, how can we calculate the final end time?
Reply to discussion (solution)
$date = new DateTime('22:50:0
For example, the release time of a movie is 22:50:00, the total length of the movie is 01:40:00, so how to calculate the final end time?
Reply to discussion (solution)
$date = new DateTime (' 22:50:00 '), $date->add (New DateInterval ('
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.