This article mainly share with you the use of PHP timestamp, this article is mainly in the form of code and we share, hope to help everyone.
$date = Date (' y-m-d ', Time ());//Today "2018-3-1"//php get today start timestamp and end timestamp
Here are some of the time functions in PHP:(1) DateUsage: Date (format, [time]);If there is no time parameter, the current time is used. The format is a string in which the following characters have special meanings:U is replaced by the number of
Here are some of the time functions in PHP:(1) DateUsage: Date (format, [time]);If there is no time parameter, the current time is used. The format is a string, where the following characters have special meanings:U is replaced by the number of
Here are some of the time functions in PHP:(1) DateUsage: Date (format, [time]);If there is no time parameter, the current time is used. The format is a string in which the following characters have special meanings:U is replaced by the number of
Copy CodeThe code is as follows:
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
PHP-time (), date (), mktime () date and time function library. Checkdate verifies the correctness of the date. Syntax: intcheckdate (intmonth, intday, intyear); return value: integer function type: time and date content description if the date is
Php date processing code
Echo"";Echo date ("Y-m-d", strtotime ("now"), "\ n ";Echo"";Echo date ("Y-m-d", strtotime ("-1 week Monday"), "\ n ";Echo"";Echo date ("Y-m-d", strtotime ("-1 week Sunday"), "\ n
PHP: time (), date (), mktime () date and time function libraries are often forgotten. here, you can add them to your favorites for convenience: checkdate: to verify the correctness of the date.
Date: format the server time.
Strftime: format the
Php output previous day last week last month last quarter
"; Echo date (" Y-m-d ", strtotime (" now ")," \ n "; echo""; Echo date (" Y-m-d ", strtotime ("-1 week Monday ")," \ n "; echo""; Echo date (" Y-m-d ", strtotime ("-1 week Sunday ")," \ n "
This article mainly introduces the time function date in PHP and the relevant knowledge of time calculation, which has a good reference value. Let's take a look at the little series.
have been in the project need to use to today, yesterday, this
Checkdate: Verify that the date is correct.
Date: format the server time.
Strftime: format the server time locally.
Getdate: Get the time and date information.
Gettimeofday: Get the current time.
Gmdate: Get the current time difference from
Common time method Public function Invitationtime ($type, $v) {if ($type ==1) {//Today $beginToday = Mktime (0,0,0,date (' m '), date (' d '), Date (' Y ')); $endToday = Mktime (0,0,0,date (' m '), date (' d ') +1,date (' Y '))-1; $where = "Superior
The MySQL query statement on line NO. 346
The code is as follows
Copy Code
$sql = "Select Gid,title from". Db_prefix. "Blog WHERE hide= ' n ' and type= ' blog ' ORDER by the views DESC, Comnum DESC LIMIT 0, $num";
Example
$t = time ();
Start time stamp
$start = Mktime (0,0,0,date ("M", $t), date ("D", $t), date ("Y", $t));
End time stamp
$end = Mktime (23,59,59,date ("M", $t), date ("D", $t), date ("Y", $t));The definition and specific usage of the
Checkdate:
Verify the correctness of the date.
Date:
Format the time of the server.
Strftime:
The time of the server is formatted locally.
GETDATE:
Get time and date information.
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.