I recently configured a wamp Server, but found that the time is different from the local time, and the time obtained by using time is displayed as date, the following describes the causes and solutions.
If the date time is inconsistent, use
During work, it sometimes takes time to convert to a few months ago, a few weeks ago, a few days ago, a few hours ago, a few minutes ago, or a few seconds ago, below is a general method to keep it. * ** time conversion * @ paramtype $ timestamp * @
$ Timestamp123163300; from1970110: 0: 0 $ datetimedate (Y-m-dH: I: s, $ timestamp); strtotime ($ datetime) echodate (Ymd) time (); the current timestamp getdate (time) microtime (); returns a string, which is separated into two parts. The latter
Godaddy hosts are abroad. The time zone conversion may be required when the site is built outside China. The following is a convenient tool function for time zone conversion.
The code is as follows:
/** Time zone conversion*/Function toTimeZone
The PHP retrieval time is excluded from Saturday and Sunday. Today, I will share with you a function that gets a timestamp after 10 days. the key to the program is that it may not count as Saturday. If you have other requirements. It can be changed
Unix time stamp
Date format a local time and date
Time () returns the current UNIX timestamp
Microtime returns the current UNIX timestamp and number of microseconds
LocalTime Get local time
Date_default_timezone_get (time zone) gets the
If the system does not have a time zone set, then the result is UTC time, which is 8 hours from the Chinese user.
23) | | $hs && ($h )) return false; if ($m > | | $m | | $s = 0 && $hour = 6 && $hour = 8 && $hour = && $hour = &&
The time in PHP has 2 formatting functions: Date () and Gmdate (), which are described in the official documentation:
Date--Formatting a local time/date
Gmdate--Formats a GMT/UTC date/time and returns Greenwich Mean Time (GMT).
For example, we
[PHP] computing time difference in php about time computing is sometimes very troublesome! However, I believe that any language can find a way to stick to the rule rate. it is absolutely amazing to break the bean curd. calculating the time
The initialization statement for adding time to the program: "Date_default_timezone_set (" Asia/shanghai ");
Definition and usage
The Date_default_timezone_set () function sets the default timezone used by all date/time functions.The function of
This article introduces a time-date conversion custom function in PHP that can be used to convert events representing seconds to years, months, days, hours, and other time formats.
The code is as follows
Copy Code
function
All functions in PHP are in the Unix era, starting January 1, 1970.
The date is the number of seconds from this time onwards.
When a function call is counted as the number of seconds from this time, it is treated as a (timestamp) timestamp.
local
Commonly used time functions:
1.time (); Gets the total number of seconds from 1970/1/1 00:00:00 to now
2.mktime (); Set time
3.date (); Detailed information about the time of acquisition
Representative String
Description
Php learning about time. Time Functions: strftime format the local time/date according to the region settings strptime parse the date/time setlocale function generated by strftime () to set the region information (local domain information about the
1. Determine the day of the week
/**
* Determine the day of the week
* @param $date format ' YYYY-MM-DD ' format error returns false to correctly return a day from Monday to Sunday of the corresponding date
*/
function
The sum of time computing in PHP. Calculating the time difference in php is sometimes troublesome! However, I believe that any language, as long as it holds the rule rate, will be able to find a way, it is absolutely magical. Computing time
If the date time is inconsistent, use date_default_timezone_set to set the time zone: The code is as follows:Copy code Date_default_timezone_set ('Asia/Chongqing '); // Obtain the current timeEcho date ('Y-m-d H: I: S', time ());Echo " "; //
Duration
READ: ["Time"]=> string (3) "224"
Seconds
How to show on the page is: 3.7333333333333 seconds
How to convert?
Reply to discussion (solution)
Look at the Number_format () function.
Look at the Number_format () function.---------
Conversion between the PHP timestamp and date. In php, if you want to convert a date to a timestamp, you can directly use the strtotime function. if you want to convert a timestamp to a date, you can directly use the date () function, in php, if we
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.