CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)DescriptionThis style is typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar)It is only used when converting
Software development and outsourcing to Japan-Project Management
Over-bandwidth: over-bandwidth exceeding the unit pricePre-production: pre-productionSpecies: species: SpeciesTime limit setting: Time Limit settingMarkLoading Rate indexing: loading
A, date () function
string Date (string $format [, int $timestamp])Function: Formats the timestamp as an easy-to-read time and date.
Parameters
Description
Format
Necessary. Specifies
Reproduced in this blog, the original blog: http://blog.csdn.net/baiduandxunlei/article/details/9180075CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)DescriptionThis style is typically in the time type
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,
first, related categories1. Date:Date represents a specific moment, accurate to milliseconds, and the corresponding method in date is deprecated, starting with JDK 1.1, you should use the Calendar class to implement conversion between date and Time
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 ()
1.java.sql.timestampThe specific time we take from the database is typically java.sql.Timestamp type. Java.sql.Timestamp is a subclass of Java.util.Date. Java.sql.Timestamp contains dates and times, and Java.sql.Date contains only dates.It adds
After obtaining the time through the date () function, it is found that the hour time is incorrect, which is 8 hours less than the current time. Both H and h are the same, this is because the Greenwich Mean Time is obtained, which is 8 hours
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.