One of the most recent projects has a foreground for the table header requirements:Returns the shape of a given date period asMar 2015 3/20-3/31APR 2015 4/1-4/30This month year data, simply write down the code, temporarily did not think of a better
var New date (), alert (date),//Get current timeAlert (Date.getfullyear ());//get Current year scoreAlert (Date.getmonth ());//Get month (get the current month plus 1)Alert (Date.getdate ());//Gets the number of the current dateAlert (Date.getday ())
1, return the current time corresponding to the first week of the year:Import datetime>>> datetime.datetime.now (). Isocalendar () (2018, 1, 4) # The result indicates that the current date corresponds to the 4th day of the 1th week of 2018 years,
Calculate the number of days in the current month based on the given date. You may want to implement this function. Therefore, this article is quite necessary. Next, let's look at the implementation code, if you are interested, you can understand it.
Declare @ date & nbsp; datetimeset @ dategetdate (): Current date + Monday (2nd days per week) the number of days difference from the current date -- datepart (weekday, date) the returned value is related to @ datefirst setdatefirst7 -- or set it to
The example in this article describes how PHP gets the number of days between a given date. Share to everyone for your reference, as follows:
Method One:
Run Result: 187
Method Two:
Operation Result:
Today differs from August 26
This article mainly introduces PHP to calculate the start date and end date of the week of the given date, involving PHP date and time-related operations and conversion skills, with a certain reference value, the need for friends can refer to the
DECLARE @date datetime;
Set @date = GETDATE ()
--the number of days between the first day of the month and the first of the following month
Select DateDiff (Day,dateadd (Month,datediff (month,0, @date), 0), DateAdd (Month,1+datediff (month,0,
How to implement a number of days after a given date (somewhat like DateAdd in VB)
/*
Tofu production is a boutique
Http://www.asp888.net Tofu Technology Station
If reproduced please retain the full copyright information
*/
These days suddenly a lot
1. Function Description:Date_trunc: Intercept a given time (timestamp,date) to get the initial time of the specified precision (time, day, month, year)2. General TimeDate_trunc (' Hour ', TIMESTAMP ' 2018-08-16 20:38:40 ')Result:2018-08-16
Calculate the number of days in the current month based on the given date. You may want to implement this function. Therefore, this article is quite necessary. Next, let's look at the implementation code, if you are interested, you can understand it.
How to implement the date several days after the given date suddenly many people ask this question, that is, how to implement the DateAdd function in VB in PHP! This is a question.
This was originally an exam question when tofu went to Huawei to
This article mainly introduces PHP to get a given date difference between the days of the method, combined with a specific instance of the form of analysis of the 2 days of date difference calculation method, involving the PHP date string conversion
Obtain the start date of the week based on the given date format & amp; apos; YYYY-mm-dd & amp; apos;
Common Date Operations
/**
* Get the start date of all weeks in a year
* @ Param $ year format 'yyyy'
* Returns
SQL determines whether a given date is the year of the Leap years statement--judging by the total number of days in the yearDECLARE @date datetime;Set @date = GETDATE ()Select Case DateDiff (Day,dateadd (Year,datediff (year,0, @date), 0), DateAdd
Queries the previous Sunday (Sunday is first day) SQL statement for the week on which the given date is located
DECLARE @date datetime
Set @date = GETDATE ()
--Train of thought: The current Diary of the Week in Sunday minus 1 weeks
The return
Calculates the 2nd day of the week on which the given date is located (Sunday is the first day)
DECLARE @date datetime
Set @date = GETDATE ()
--Train of thought: current date + Monday (2nd day of the week) and the difference between the current
DECLARE @ DateDATETIMESET @ DateGETDATE () -- previous DAY, previous DAY of given Date SELECTDATEADD (DAY,-1, @ Date) AS previous DAY -- next DAY, next DAY of given Date SELECTDATEADD (DAY, 1, @ Date) AS the next day GO -- the beginning of the month,
No nonsense.CodeThe comment is very detailed. It is certainly okay to understand it!
Declare @ date datetimeSet @ date = getdate ()-The previous day, the previous day of the given dateSelect dateadd (day,-1, @ date) as 'previous Day'-The next day,
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.