', ' two ', ' three ', ' four ', ' five ', ' six ']; switch (interval) {case ' Y ':p artstr = Mydate.getfullyear (); Case ' m ':p artstr = Mydate.getmonth () +1;break; Case ' d ':p artstr = Mydate.getdate (); Case ' W ':p artstr = Week[mydate.getday ()];break; Case ' ww ':p artstr = Mydate.weeknumofyear (); Case ' h ':p artstr = mydate.gethours (); Case ' n ':p artstr = Mydate.getminutes (); Case ' s ':p artstr = Mydate.getseconds (); return partstr; } //+---------------------------------------
DateAdd Function
Returns the date of the specified interval.
DateAdd(interval, number, date)Parameters
Interval
Required. String expression, indicating the time interval to be added. For values, see the "Settings" section.
Number
Required. Numeric expression, indicating the number of time intervals to be added. A numeric expression can be a positive number (to ge
DATEADD function
Returns the date that the specified time interval has been added.
DateAdd(interval, number, date)
Parameters
Interval
Required option. A string expression that represents the time interval to add. For numeric values, see the "Settings" section.
Number
Required option. Numeric expression that represents the number of time intervals to add. Numeric
IamlaosongThe DateAdd function returns a date that is added to a time interval. This function can be used to calculate many of the dates we need, such as last month's year-earlier date. GrammarDATEADD (interval, number, date)The following named parameters are available in the DATEADD
The project needs to use the calendar,. NET calendar control is too heavy, had to write with JS, the core function of the calendar is DateAdd (), the writing process found in JS inside operation time than the imagination of tedious, not like VBScript can easily DateAdd, and then think of using setFullYear (), setdate () and other built-in functions, you can flatt
SELECT DATEDIFF (year, ' 1992-11-28 ', GETDATE ())--age, where year can be replaced by day MONTHSELECT DATEPART (Month,getdate ())-Returns an integer representing the specified date portion of the specified date. such as 12SELECT datename (WEEKDAY, ' 2014-11-12 ')--Returns the specified day of the week, such as Monday,SELECT Datename (Weekday,getdate ())--Returns the current date is the day of the weekSELECT Datename (Week,getdate ())--Returns the current number of weeks of the year, such as 51E
--Date function--getdate (): Gets the current date--dateadd (interval unit, increment value, source date value): Adds a date value for a specified interval for the specified dateSelect DATEADD (Mm,3,getdate ())Select DATEADD (Mm,-3,getdate ())--datediff (interval unit, start date, end date) Gets the difference value be
The date and time functions in SQL Server are always problematic in this regard. So, I will summarize what I mainly useDatepart(Month, getdate (). This item can be set to day (now () in access. Unfortunately, the day () in SQL Server does not support parameters.Date and time functions in SQL Server
These scalar functions operate on the input values of date and time, and return a string, numeric value, or Date and Time Value.
The following table lists Date and Time Functions and Their determinist
Definition and usageThe DATEADD () function adds or subtracts a specified time interval from a date.GrammarDATEADD (datepart,number, date) The date parameter is a valid day expression. The number is the number of intervals you want to add, and for the future time, this is positive, and for the past time, this number is negative.The datepart parameter can be the following value:
DatePart
Definition and usage
The DATEADD () function adds or removes the specified time interval in the date.Syntax
DATEADD(datepart,number,date)
DateA parameter is a valid date expression.NumberIs the number of intervals you want to add. For the future time, this number is a positive number, and for the past time, this number is a negative number.
DatepartParameters can
DateAdd function usage in ASP
2006/09/22 12:29
Note that the VBS and SQL are slightly different, and the following posts are for the VBS help.
SQL searchable SQL self-help document
A string expression that represents the time interval to add. For numeric values, see the "Settings" section.
Returns the date that the specified time interval has been added.
DATEADD
DateAdd function:
Copy Code code as follows:
function DateAdd (interval,number,date) {
Switch (Interval.tolowercase ()) {
Case "Y": Return new Date (Date.setfullyear (Date.getfullyear () +number));
Case "M": Return new Date (Date.setmonth (Date.getmonth () +number));
Case "D": Return new Date (Da
Sybase Date functionDate functionGETDATE ()Get the current time, can be set to get a variety of time formats.DATEPART (date part, date)Take a certain part of the specified time, month and day seconds.DateDiff (date part, date 1, date 2)Calculates the time difference between the specified date 1 and date 2.DATEADD (date part, numeric expression, date)Calculates the specified time, plus the length of time spe
This function library is almost exactly the same as the SQL Server database function library, which is actually the first occurrence of this function before the SQL Server database function library appears.
Sybase and MS SQL Server 6.x are almost identical to the user's poi
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.