PHP datetime function Date () 1, year-month-day echo date (' Y-m-j '), 2007-02-6 echo date (' Y-n-j '), 07-2-6 uppercase Y for year four digits, and lowercase y for year two digits, and lowercase m for month numbers ( With a leading), while
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
Date-time functions are a core part of PHP. These functions can be used without installation. The specific use of the date function is described in detail below:
PHP Date () functionThe PHP date () function formats the timestamp as a date and time
The current date is "2016/06/14 Tuesday"
So last week's time zone was "2016/06/06"-"2016/06/12."
Only the current date has not been completed (this is not done in Sunday)
Then last week would have been "2016/06/06"-"2016/06/12."
Find out how PHP
PHP's display time code is much more powerful than ASP, making it easier to call. 1. year-month-day echodate (& amp; #39; Y-m-j & amp; #39;); 2012-02-6echodate (& amp; #39; y-n-j & amp; #39;); 07-2-6 uppercase Y indicates four digits of the year,
PHP datetime function Date ()
1, year-month-day
echo Date (' y-m-j ');
2007-02-6
echo Date (' y-n-j ');
07-2-6
Uppercase Y represents the year four digits, while lowercase y represents the two digits of the year;
Lowercase m represents the
A very good PHP calendar code
Copy CodeThe code is as follows:
/**
* Calendar
*
* Copyright (c) by Chen Yixin (Deep Space). All rights reserved
* To contact the author write to {@link mailto:shenkong@php.net}
* @author Chen Yixin (Deep
PHP Date function common time processing method, date processing method
Copy the Code code as follows:echo "Today:". Date ("y-m-d"). "";echo "Yesterday:". Date ("Y-m-d", Strtotime ("-1 Day")), "";echo "Tomorrow:". Date ("Y-m-d", Strtotime ("+1 Day")
PHP gets this week's Monday specific date method, PHP gets this Monday
This example describes how PHP gets the exact date of the week Monday. Share to everyone for your reference. Specific as follows:
Private Function Mondaytime ($timestamp =0, $is
PHP returns the current date or the specified date is a few weeks, PHP is currently
PHP Week Get Code:
Copy the Code code as follows:Date ("L"); Data can be obtained in English for weeks such as SundayDate ("W"); This can get the numbers for weeks
PHP date and time functions date () 1, year-month-day echodate (& #39; Y-m-j & #39;); 2007-02-6echodate (& #39; y-n-j & #39;); 07-2-6 uppercase Y indicates four digits of the year, while lowercase y indicates two digits of the year. lowercase m
Copy CodeThe code is as follows:
$now =time (); Current time
$StrUpdate = "Update $tbl _article set hits=hits+1";
if (Date ("D", $lasthittime) ==date ("D", $now)) {//the same day
$StrUpdate = $StrUpdate. ", dayhits = dayhits+1";
}else{
$StrUpdate = $
The original address of this addressOutline:1. Introduction2. Code examples3. References1. Introduction
See a piece of code today$timeNew Date Strtotime ($oldTime));Feel a little confused, query the PHP manual, Date function, organized as
PHP gets the start timestamp and end timestamp of today, yesterday, last week, this month, mainly using PHP's time function mktime ().The Mktime function uses the following: Mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST)Parameter descriptionHour
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
Add Date_default_timezone_set (PRC) to the top page of the page; /* Transfer time to Beijing time, php5 default to Greenwich Mean Time */date () A: "AM" or "PM" A: "AM" or "PM" D: A few days, two digits, if not enough to fill 0; from "01" to "D: Day
A, date () function
string Date (string $format [, int $timestamp])Function: Formats the timestamp as an easy-to-read time and date.
Parameters
Description
Format
Necessary. Specifies
Php obtains the day of a day, the day of the week, and the date corresponding to the day of the week and the day of the week.
$ Today = date ("Y-m-d ");
Echo $ today; // you can get the number of today. Output
// Define an array first.
$
Date_default_timezone_get (): Gets the current time zone of PHP date_default_timezone_set (): Sets the current time zone for PHPDate ("Y-m-d h-i-s")time (): Returns the current timestamp (1970-1-1--to date) unit seconds
strtotime (): Converts the
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.