This article summarizes the usage and data conversion of DateTime functions and a simple reference manual.
This article summarizes the usage and data conversion of DateTime functions and a simple reference manual.
DateTime-related functions are
We often use a variety of date formats for some purpose. Of course, we can use string operations to construct various date formats, but why are there any ready-made functions? The default datetime format of the Chinese version of SQL Server is
We often use a variety of date formats for some purpose. Of course, we can use string operations to construct various date formats, but why are there any ready-made functions?
The default datetime format of the Chinese version of SQL Server is
My code:
Convert (date, mydatetime)
Bytes --------------------------------------------------------------------------------------------------------------------------
Generally, the time format stored in the database isYyyy-mm-DDHH: mm: SSIf you want
How to Use CONVERT:
Format:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, char, varchar)It is used only when they are converted to each
Original: Convert date formatting in ms SQL Server
ConvertExplicitly converts a data type expression to another data type. Because some requirements often use different date formats, the following can be found inFormat the date in SQL
DateTime-related functions are often used in the T-SQL, and common functions are summarized to be forgotten.We often use various date formats for some purpose. Of course we can use string operations to construct various date formats, but why are
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
Let's take a look at the functions used.CONVERT in SQLFormat:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, char, varchar)It is used only when they
sed jobs:1. Delete the first character of each line of the file.Sed ' s/.//' install.logSed-n ' S/^.//GP '/etc/passwd sed-nr ' s/(.) (. *)/\2/p '/etc/passwd2, delete the second character of each line of the file.Sed ' S/.//2 ' install.logSed ' s/(.)
In: equivalent join, used to find records with the same fields in multiple tablesNot in: Non-equivalent join, used to find records that do not existInner join: inner join, mainly used to find records that all meet the conditionsLeft join: left join.
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.