When it comes time to believe that we are not unfamiliar, because whether we are in the development of any project, basically there will be displayed time, creation time, modification time and time to obtain the situation, time is as a record of good vouchers, also as a sort of label, the importance of time can imagine, Today we tell you how PHP gets the last week, the next week, and the last weekend's implementation ~
First download the PHP we need for this lesson to get the class library for
-The 1 Monday output is the time of this Monday, which is very strange.-1 Monday output is the time of this Monday, which is very strange.
Reply content:
-1 the Monday output is the Monday time, which is very strange.
Because
How PHP gets the exact date of the week Monday
This article mainly introduces the method of PHP to get the specific date of this week Monday, involving PHP operation skills for the date, very practical value, interested friends can integrate the code snippet into their own date class to facilitate later invocation, the need for friends can refer to the next
This example describes how PHP gets the exact dat
Take out time stamps for Monday and Sunday
can go through the following two out of the Monday and Sunday time stamp instances can see a lot of things, to keep thinking Oh, the first custom to take out the time stamp of the specified date is better, but how to take out Monday and Sunday second is more practical.
*/
function Getmonsun () { $curtime =time ();
In many cases, this week's statistics are required for database query statistics.
I don't want to hand over the computing task to the data here.
So I wrote a small function myself to get the time of Monday and weekend of this week. When the database is compared, I only need between... and.
Code As follows:
# Region returns the Monday and Sunday dates of the week.
/// /// Calculate the
Php extracts the timestamp of Monday and Sunday. Taking out the timestamp of Monday and Sunday can be seen through the following two examples of taking out the timestamp of Monday and Sunday. we need to keep thinking about it, the first custom fetch specifies the day to retrieve the timestamp of Monday and Sunday.
We c
In php, strtotime returns the Monday of the given time. In a simple php strtotime, return the Monday implementation code of the time. if you need it, refer to it. The strtotime () function resolves the date and time description of any English text into a simple php strtotime to return the Monday implementation code of the time. if you need it, refer to it.
The st
Oracle query statement from last Monday to weekend
[SQL] -- Oracle obtains the SQL statement from the last Monday to the weekend -- in this way, select to_char (to_date ('123 ', 'yyyymmdd'), 'D') from dual; -- result: 6 Note: 2013.09.06 is Friday, which is the sixth day of this week. select to_char (sysdate + (2-to_char (sysdate, 'D')-7, 'yyyymmdd') from dual; --- last
Copy Code code as follows:
-Oracle takes the SQL from Monday to the weekend
This takes the first days of the week, starting with Sunday.
Select To_char (to_date (' 20130906 ', ' yyyymmdd '), ' d ') from dual;
--Result: 6 Note: 2013.09.06 is Friday, the sixth day of the week
Select To_char (sysdate+ (2-to_char (sysdate, ' d '))-7, ' YYYYMMDD ') from dual;---Monday
Select To_char (sysdate+ (2-t
Obtain the time from Monday to Sunday of the current week. obtain the time from Monday to Sunday of the current week.
$ Date = new DateTime (); // Time object $ date-> modify ('This Week'); // specify the week, echo $ date-> format ('Y-m-D') on the first day of the week by default '); // output the day of Monday $ date-> modify ('this week + 6 days '); // echo
Monday date of day
Private Function Mondaytime ($timestamp =0, $is _return_timestamp=true) {
Stati c $cache;
$id = $timestamp. $is _return_timestamp;
if (!isset ($cache [$id])) {
if (! $timestamp) $timestamp = time ();
$monday _date = Date (' y-m-d ', $timestamp -86400*date (' W ', $timestamp) + (date (' W ', $timestamp) >0?86400:-/*6* 86400*/51
This week, 1st, returns the result format: 2014-5-5 0:00:00public static DateTime Getmondaydate (){DateTime Dt=datetime.now;int today= (int) dt. DayOfWeek;if (dt. Dayofweek.tostring ()! = "Sunday")//You can also use the today!=0{Return dt. AddDays (1-today). Date;}Else{Return dt. AddDays ( -6-today). date;//If today is Sunday, get the week 1st period is the date of the next Monday, so subtract 7 days}}This Sunday daypublic static DateTime Getsundaydat
This article mainly introduces the method of PHP to get the specific date of this week Monday, involving PHP operation skills for the date, very practical value, interested friends can integrate the code snippet into their own date class to facilitate later invocation, the need for friends can refer to the next
This example describes how PHP gets the exact date of the week Monday. Specific as follows:
Pr
This article mainly introduces PHP to get this week Monday date of the method, involved in the PHP date-oriented operation skills, very practical value, interested friends can integrate the code fragment into their own date class to facilitate future calls, the need for friends can refer to the
The examples in this article describe how PHP gets the date of the week Monday. Share to everyone for your refere
DECLARE @date datetime;
Set @date = GETDATE ()
--Thinking, 1900-01-01 (Monday) plus (given a log of the month of 6th month and 1900-01-01 weeks) week
Why not choose number 7th? If it is number 7th, then 7 is exactly Sunday, the first Monday will be counted to 8th.
Why not choose number 5th? If number 5th is Saturday, Monday will be last month. Less than numbe
Write a program that receives a number and displays dependent information based on user input. The switch statement is required, for example, 1, 2, 3, display, Monday, Tuesday, and Wednesday,
// Author: Janushu // Date: 2017/9/20/* function: write a program that can receive a number and display dependent information based on user input, the switch statement is required. For example, 1 2 3 shows Monday, Tue
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.