Alibabacloud.com offers a wide variety of articles about british date format with day of week, easily find your british date format with day of week information here online.
Common date functions
SQL Server time and date function detailed, SQL Server, time, date,
1. Current system date, time
Select GETDATE ()
2. DateAdd returns a new datetime value on the basis of adding a period of time to the specified date
For
SQL statement gets a specific date
1. The first day of one months
Select DATEADD (mm, DATEDIFF (Mm,0,getdate ()), 0)
2. Monday of this week
Select DATEADD (wk, DATEDIFF (Wk,0,getdate ()), 0)
3. The first day of the year
Select DATEADD (yy,
SQL Server Date functionThe following table lists the most important built-in date functions in SQL Server:
function
Description
GETDATE ()
Returns the current date and time
DATEPART ()
CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)
DescriptionThis style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)When they are converted to each
Example: DateDiff (Dd,add_time,getdate ()) not between 0 and 7Select COUNT (*) fromtable where DATEDIFF ([second], ' 2004-09-18 00:00:18 ', ' 2004-09-18 00:00:19 ') > 0DescriptionSelect DATEDIFF (Day, time1, time2) corresponds to the following
Data operation date and time
Date and time functions are useful for building a site. The owner of the site is often interested in when the data in a table is updated. With date and time functions, you can track changes in a table at the millisecond
Atitit. Get Beijing Time CST function API Summary O71. Get CST time ( Beijing time ) two cloth:1. Crawl URL Timtstamp >>format to the CST 12. Set the native time setsystime(date); : Called command line, only supported for Windows and Linux Systems
Atitit. Get Beijing Time CST function API Summary O71. Get CST time ( Beijing time ) two cloth:1. Crawl URL Timtstamp >>format to the CST 1 2. Set native time setsystime : The command line that is called can only support windows Span style=
One: Datatime in SQL1. Between and equals >= and 2. Commonly used methods of querying datatime into stringsSelect CONVERT (varchar), GETDATE (), at $)://YYYY-MM-DDSelect CONVERT (varchar), GETDATE (), ()://Yyyy-mm-dd HH:MM:SSSelect CONVERT (varchar),
function
Description
GETDATE ()
Returns the current date and time
DATEPART ()
Returns a separate part of the date/time
DATEADD ()
Add or subtract a specified time interval in a date
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.