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 and Time Processing set
When the convert date conversion format is 20 or 120, the resulting string does not contain milliseconds.For example, select convert (varchar (23), getdate (), 120 or 20)21:46:43
When the date conversion
In sqlserver2000, convert is used to obtain the processing result of the datetime data type style (full) date data format. Two examples are as follows: CONVERT (varchar (16), time 1, 20: 2007-02-0108:02 * The time is generally the * CONVERT (varchar
Use convert in SQL server2000 to obtain the datetime data type style (full)
Processing of date data format:
CONVERT (varchar (16), time 1, 20) Result:/* The time is generally the getdate () function or the field in the data table */
Result of
? In sqlserver, convert is used to obtain the processing of datetime data format (full). Two examples are as follows: CONVERT (varchar (16), time 1, 20) Result: 2007-02-0108:02 * The time is generally the * CONVERT (varchar (10), time 1, 23) Result
Use convert in Sql server2000 to get datetime data type style (full)
Date data format processing, two examples:
CONVERT (varchar (16), time one, 20) Result: 2007-02-01 08:02/* time is generally getdate () function or field in Datasheet * *
Technical key: DateFormat class in Java.text Package 1. Get date Formatter public static final DateFormat getdateinstance (int style,locale alocale) This method is used to get the date format objects for the specified style and locale. Parameter
How SQL SERVER 2000 obtains the current system time with SQL statementsis to use GETDATE ();
getdate in SQL () January 08, 2008 Tuesday 14:59A very powerful date format function in SQL Server
Copy Code code as follows:
Select CONVERT
Java Java.util.Calendar is used for date and time operations. Use this class whenever you have some minor actions (other than just the date and time) that you need to perform. (Original: Whenever you have something slightly more advanced than just
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.