S? Q? L? ? ? When? Before? Hour? Between? (? ? Period ?)

Source: Internet
Author: User

-- Obtain the current date (for example, yyyymmdd) Select convert (nvarchar (12), getdate (), 112)

-- Obtain the current date (for example, yyyymmdd hh: mm: SS) Select getdate ()

-- Obtain the current date (for example, yyyy-mm-dd) Select datename (year, getdate () + '-' + datename (month, getdate ()) + '-' + datename (day, getdate ())

-- Obtain the current date (for example, yyyy/mm/DD) Select datename (year, getdate () + '/' + datename (month, getdate ()) + '/' + datename (day, getdate ())

-- Obtain several date select datename (year, getdate ())

-- Year (yyyy) Select datename (YY, getdate () Select datename (mm, getdate ())

-- Select datename (DD, getdate () of the month ())

-- Date select datename (HH, getdate ())

-- Obtain hour select datename (MI, getdate ())

-- Obtain the minute select datename (second, getdate ())

-- Obtain the second select datename (Week, getdate ())

-- Obtain the week (week) is the week (week) in the year select datename (weekday, getdate ())

-- Day of the week -- date conversion

-- For example, 2011-10-24 15:57:16 select convert (varchar, getdate (), 120) Select convert (varchar, getdate (), 111) + ''+ datename (HH, getdate ()) + ':' + datename (MI, getdate () + ':' + datename (second, getdate ())

-- For example, 20111024155657 select Replace (replace (convert (varchar, getdate (), 120 ),'-',''),'',''),':', '')

-- For example, 2011/10/24 select convert (varchar (12), getdate (), 111)

-- For example, 20111024 select convert (varchar (12), getdate (), 112)

-- Example: 2011.10.24 select convert (varchar (12), getdate (), 102)

-- Example: 10/24/2011 select convert (varchar (12), getdate (), 101)

-- Example: 24/10/2011 select convert (varchar (12), getdate (), 103)

-- Example: 24.10.2011 select convert (varchar (12), getdate (), 104)

-- For example, 24-10-2011 select convert (varchar (12), getdate (), 105)

-- For example, 24 10 2011 select convert (varchar (12), getdate (), 106)

-- Example 10 24,201 1 select convert (varchar (12), getdate (), 107)

-- Example: 16:01:18 select convert (varchar (12), getdate (), 108)

-- For example, 10 24 2011 select convert (varchar (12), getdate (), 109)

-- For example, select convert (varchar (12), getdate (), 110)

From: http://wenku.baidu.com/linkurl=3MsrNKUOGUcKq3y_d_h6QSGjeESFBgU6JCY8Gx5eD9iRiT651lQF9p5aJu6Nc4DCLCs9_ypC0x99jrv1wcdP5q4PjDdknsB0r8AZpbOVqti

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.