PHP get Timestamp is implemented by the PHP time () function, the PHP get date is implemented by the PHP data () function, they are specifically how to implement, the following gives a concrete example.
Setting the time
PHP gets the start timestamp and end timestamp of today, yesterday, last week, this month, mainly using PHP's time function mktime. Let's start with a straight-through example to illustrate how to use Mktime to get the start timestamp and end
Copy codeThe Code is as follows:// Php obtains the start Timestamp and end timestamp of today.$ BeginToday = mktime (0, 0, 0, date ('M'), date ('D'), date ('y '));$ EndToday = mktime (0, 0, date ('M'), date ('D') + 1, date ('y')-1;
// Php obtains
PHP gets today's start timestamp and end timestamp$beginToday =mktime (0,0,0,date (' m '), date (' d '), date (' Y '));$endToday =mktime (0,0,0,date (' m '), date (' d ') +1,date (' Y '))-1;PHP gets yesterday start timestamp and end
Use php to get the code for the date of this week, last week, this month, last month, and this quarter.
The code is as follows:
Echo date ("Ymd", strtotime ("now"), "\ n ";
Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";
Echo date ("Ymd",
PHP obtains code for last week, this week, last month, this month, this quarter, and the last quarter.
Echo date ("Ymd", strtotime ("now"), "\ n ";
Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";
PHP php code used to obtain the time methods of last week, this week, last month, this month, this quarter, and the last quarter
Last week start time:'; Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m"), date ("d ") -date ("w") + 1-7, date (
Copy codeThe Code is as follows:Echo date ("Ymd", strtotime ("now"), "\ n ";Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";Echo date ("Ymd", strtotime ("-1 week Sunday"), "\ n ";Echo date ("Ymd", strtotime ("+ 0 week Monday"), "\ n ";Echo
This article to introduce you to the use of PHP with Strtotime or mktime specified date data (this week, last week, this month, last month, this quarter) instance, I hope that the students will help you.Strtotime Definition and usageThe strtotime ()
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time,
Php date instance: get last week, this week, last month, this month, this quarter, last quarter
For example, php obtained last week, this week, last month, this month, this quarter, and the last quarter.
PHP gets last week, this week, last month, this month, this quarter, last quarter
Source: http://hudeyong926.iteye.com/blog/729193
Last week:'; Echo date ("Y-m-d h:i:s", mktime (0, 0, 0,date ("M"), Date ("D")-date ("W") +1-7,date ("Y")), "\ n",
Array: "Focus 1"Implode (delimited, arr) connects the array value data to the specified characters.
For example:
$arr =array (' 1 ', ' 2 ', ' 3 ', ' 4 ');
$str =implode ('-', $arr);
Explode ([delimited],arr) splits a string by the specified rule,
PHP Common Functions Summary sharing
For you to share PHP commonly used array, string, time, file operation function, I hope to learn PHP development of friends to help.
Array: "Focus 1" implode (delimited, arr) connects the array value data to
Use php to obtain the echodate (Ymd, strtotime (now), n ;?? Echodate (Ymd, strtotime (-1 weekMonday), n ;?? Echodate (Ymd, strtotime (-1 weekSunday), obtained this week, last week, this month, last month, and this quarter date using php (abstract)
How do I get the timestamp of this week, last week, this month, the beginning and the end of the month
Reply to discussion (solution)
echo Date ("Ymd", Strtotime ("Now"), "\ n";echo Date ("Ymd", Strtotime ("1 week Monday")), "\ n";echo Date ("
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.