Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sql date type

2025-03-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Declare @ datetime datetime = Current_Timestamp, @ date date = Current_Timestamp, @ time time = Current_Timestampselect @ datetime-- 2018-06-08 09:01:10.440select @ date-- 2018-06-08select @ time-- the 09:01:10.4400000-DATEADD () function adds or subtracts the specified time interval from the date. -select Dateadd (dMagol 1 recording 2018-01-01 00 00.000')-- 2018-01-02 00:00:00.000-DATEDIFF () function returns the time between two dates. -- select datediff (day,Convert (date,'20181101'), Convert (date,'20181028'))-- (- 4) select Datediff (djournal "2018-01-01-01")-- 1--DateName returns the string type SELECT GETDATE () AS current date, DATENAME (YEAR) GETDATE () AS year, DATENAME (MONTH, GETDATE ()) AS month, DATENAME (DAY, GETDATE ()) AS day, DATENAME (quarter, GETDATE ()) AS quarter, DATENAME (dayofyear, GETDATE () AS), DATENAME (dw, GETDATE () AS week, DATENAME (week, GETDATE ()) AS week When DATENAME (hour, GETDATE ()) AS, DATENAME (minute, GETDATE ()) AS minutes, DATENAME (second,GETDATE ()) AS seconds, DATENAME (millisecond,GETDATE ()) AS millisecond select Datepart (yy,GETDATE ())-return numeric type select Isdate ('2018-01-32')-determine whether the string is a date, 1, or 0select YEAR (GETDATE () as year) Month (GETDATE ()) as month, Day (GETDATE ()) as day-returns numeric type

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report