PHP Week Get Code:1 Date ("L");2//data can get English for weeks like Sunday3 Date ("W");4//This can get digital weeks like 123, note 0 is SundayGet Chinese Weekday:1 $weekarray =array ("Day", "one", "two", "three", "four", "Five", "VI");2//define
PHP can display the date and time of the server through the date () function, and here's a detailed look at how to use the date () function to output the date:
php Date () function detailed
1, year-month-day
The code is as follows
The first date and last day of the month on which the PHP date is located
/*** Date of the first day of the month* @return int*/Public Function getfirstdayofmonth ($format = ' timestamp ') {$day = $this->getpart (' yy '). '-' . $this->getpart (' mm
Returns timestamp for 12:25:23 9-jul-2006echo Gmmktime (12,25,23,7,9,2006);?>
Gmdate ($format, $ts)
This function formats the UNIX time label as a date string that can be read artificially. This date string is represented as GMT (not local time).
Reason: network resource collationFrom php5.1.0 onwards, php.ini riga date.timezone This option, and by default it is the time to display (no matter what PHP command) is Greenwich Mean Time and our time (Beijing time) The difference is exactly 8
One, the PHP timestamp function gets the UNIX timestamp of the specified date Strtotime ("2009-1-22″) example is as follows:Echo strtotime ("2009-1-22″) Results: 1232553600Description: Return January 22, 2009 0:0 0 seconds timestampSecond, the PHP
This article describes the PHP date function Date format Unix time method. Share to everyone for your reference. The specific analysis is as follows:
A date function can format a UNIX time into the desired text output according to the specified
The examples in this article describe two PHP date control classes. Share to everyone for your reference. The specific analysis is as follows:
Because the job requires me to find two time and date control, this does not use JS as long as PHP
PHP (PHP training PHP Tutorial) in the date () datetime function in detail, the need for friends can refer to the next.1, year-month-dayecho Date (' y-m-j ');2007-02-6echo Date (' y-n-j ');07-2-6Uppercase Y represents the year four digits, while
Let's take a look at the efficiency of php date () and SQL FROM_UNIXTIME (). In the end, the performance is better. Let's look at the instance together.
In php, there are two methods to convert the int type Timestamp to date and time. One is to use
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
PHP date format conversion
Upload the interface to PHP
12:01:00
$ Endtime = $ this-> input-> get ('endtime ');
$ Endtime = preg_replace ('/[-:]/', '', $ endtime );
Current format
20130101120100
The format to be implemented is
20130101000000
The general practice is to split the string into a function, and then obtain the required data, such as the number of days, month, and year, and then combine them to use the strtotime function for conversion.
If you encounter a log file date format
The date () and time () functions of php are described in detail. This article introduces two common date and time functions in php: date and time. if you need them, refer to this article. The code is as follows: This article describes the usage of
This article describes how to format the UNIX time using the date function of PHP. The example shows how to use the date function in php. For more information, see
This article describes how to format the UNIX time using the date function of PHP.
1 /**2 * Date-get last day of the month3 * @return int4 */5 Public functionGet_lastday () {6 if($this->month==2) {7 $lastday=$this->is_leapyear ($this->year)? 29:28;8}ElseIf($this->month==4 | |$this->month==6 |
I am using the PHP date crawl
echo j7_getdate (' y-m-d ', ' 2010-11-15 ', ' +10 Day ');
function J7_getdate ($format, $time = ' Now ', $opt) {
Return date ("$format", Strtotime ("$time $opt"));
}
Today, when capturing system time with Echo $showtime =date ("y-m-d h:i:s"), it is found that the acquisition time does not match the time of the system.
It was found that the default time for PHP is in Greenwich time zone, so we have to change the
$a = "2001-5-2";
$date = Explode ('-', $a);
Explode splits the string by '-' to put the split data into the array, which is the part of the
$date [0] = 1997, $date [1] = 3, $date [2] = 2
$timestamp = Mktime (0,0,0, $date [1], $date [2], $date [0]);
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.