This article mainly introduces the method by which PHP obtains the number of days of the month and the date array according to the date, related to the relevant judgment, conversion and the traversal operation of the character and array of PHP, and the need of friends can refer to the following
Specific as follows:
function Get_day ($date) { $tem = explode ('-', $date);//Cut date get year and month
Javascript perfectly implements the method to return the last month's date for a given date. javascript returns the last month's date
This example describes how javascript perfectly returns the last month's date from a given date. We will share this with you for your reference. The details are as follows:
In project development, when javascript is used to process a date, because there is an initial value in the query, most of them will be pushed for one mont
MySQL query today, yesterday, nearly 7 days, nearly 30 days, this month, the last month of data method Analysis Summary:There is an article table article, the time to store the article's add-on is the Add_time field, which is of type int (5), and now you need to query the total number of articles added today and sort by time from large to small, then the query statement is as follows:SELECT * from ' article
MySQL query today, yesterday, nearly 7 days, nearly 30 days, this month, the last month of data method Analysis Summary:There is an article table article, the time to store the article's add-on is the Add_time field, which is of type int (5), and now you need to query the total number of articles added today and sort by time from large to small, then the query statement is as follows: SELECT * from ' articl
During registration, the number of days of the month changes with the change of the month. this small function is used in many places! Lt; 5 gt; change PHP code [php] lt; selectname quot; month quot; id quot; month quot; onchange quot; monthDays (this. val
During registration, the number of days of the
The code is as follows
Copy Code
Select Dateadd (Wk,datediff (Wk,0,getdate ()), 0)--MondaySelect Dateadd (Wk,datediff (Wk,0,getdate ()), 6)--SundaySelect Dateadd (Mm,datediff (Mm,0,getdate ()), 0)--earlier this monthSelect Dateadd (Ms,-3,dateadd (Mm,datediff (M,0,getdate ()) +1,0)--monthSelect Dateadd (Yy,datediff (Yy,0,getdate ()), 0)--early in the yearSelect Dateadd (Ms,-3,dateadd (yy, DATEDIFF (Yy,0,getdate ()) +1, 0)--Year-End
1) The date of the year
Th
Pay attention to one issue when calculating the value of a DATE caused by a month or a problem */SQL> www.2cto.com SQL> SELECT date' 2012- 30th day of last month, DATE '2017-11-30 'Today, add_months(DATE '1970-10-30 ', 1) increased by 2012 last month, 2 add_months (DATE '1970-11-30',-1) decreased by 2012 FROM dual this month
Show the starting and ending points of this month, last month, today, and this yearThe mktime () function returns the Unix timestamp of a date.The parameter always represents the GMT date, so is_dst has no effect on the result.The parameters can be left empty from right to left. The blank parameters are set to the corresponding current GMT value.PHP Date () functionThe PHP Date () function can format the ti
Original link: http://www.jb51.net/article/44468.htm
First, get the last day of the month (possibly 28/29/30/21) problem, the idea is simply to get the first day of the next month, the number of milliseconds from 1970, and then subtract the number of milliseconds from the day, which is the number of milliseconds to 1970 years from the last day of the month, based
packagepracticego;importjava.util.scanner;/**2. Based on the month entered, determine how many days of the month */publicclasscto{publicstaticvoidmain (String[] args) {scannersc=newscanner (system.in); System.out.println ("Enter month:"); Intmonth=sc.nextint ();switch (month) {case1:case 3:case5:case7:case8:case10:case
During registration, the number of days of the month changes with the change of the month. This small function is used in many places!
PHP code
[Php]For ($ I = 1; $ I {Echo "Echo $ I;Echo "}?>For ($ I = 1; $ I {Echo "Echo $ I;Echo "}?>For ($ I = 1; $ I {Echo "Echo $ I;Echo "}?>For ($ I = 1; $ I {Echo "Echo $ I;Echo "}?>
Js Code
[Javascript]Function monthDays (month
Obtain the year, month, and day of the current week from the year, month, and day of the current week from the year, month, and day of the current day.
PHP code
// Obtain the end date of the latest week corresponding to the year, month, and Day. the function GetClearWeek () {$ year_month_day_over = array (); $ year =
Select date_sub (now (), interval 1 month) current time of last month today select unix_timestamp (date_sub (now (), interval 1 month) current time of last month today (timestamp) select date_sub (date_format (now (), '% Y-% m-% d 08:00:00'), interval extract (day fromnow ()-1 day ), interval 1
DECLARE @date datetime
Set @date =getdate ()
--The current month first day plus 2 months minus 1 days
Select DATEADD (Day,-1,dateadd (Month,2,dateadd (month,0, @date), 0)) as ' last day of next month '
--Simplifying
Select DATEADD (Day,-1,dateadd (Month,datediff (
Objective
This function is often used in developing iOS, and the one-month interval is the first and last day, and you need to know how many days of the month to know what the last day is, and whether it is a leap year, maybe 28 days in February.
Not much to say, attached code:
-(void) viewdidload {[Super viewdidload];
Do no additional setup after loading the view, typically from a nib.
NSLog (@
Inquire
Today
The code is as follows
Copy Code
SELECT * FROM table name where To_days (Time field name) = To_days (now ());
Yesterday
The code is as follows
Copy Code
SELECT * FROM table name WHERE to_days (now ()) –to_days (Time field name)
7 days
The code is as follows
Copy Code
SELECT * FROM table name where Date_sub (Curdate (), INTERVAL 7 day)
Nearly 30 days
T
PHP displays the start and end timestamps of today, this month, last month, and this year. PHP displays the start and end timestamps of today, this month, last month, and this year $ t nbsp; nbsp ;= nbsp; nbsp; time (); $ t1 nbsp; nbsp ;= nbsp; nbsp; mktime PHP displays the start and end timestamps of today, this
PHP displays the start and end timestamp of today, this month, last month, and this year. PHP displays the start and end timestamp of today, this month, last month, and this year $ t nbsp; nbsp; time (); $ t1 nbsp; mktime (0, 0, date (m, $ t), date (d, $ t), date (Y, PHP shows the start and end timestamp of today, t
PHP obtains the year, month, and day of the current week based on the year, month, and day of the current day.
// Obtain the end date of the latest week corresponding to the year, month, and day.
Function GetClearWeek (){
$ Year_month_day_over = array ();
$ Year = date ('Y'); // year with four digits
$
PHP returns the start timestamp of the current year, month, and day, And the start timestamp of the next year, month, and day. The current Start Time
1. timestamp of the current year
2. timestamp of the current month
3. Current day Timestamp
4. Start timestamp of next year
5. Start timestamp of next month
6. Start time
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.