截取微软文档 Datetime SqlServer
2022/9/14 2:18:28
本文主要是介绍截取微软文档 Datetime SqlServer,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
-
sysdatetime
sysdatetime()
Returns a datetime2(7) value containing the date and time of the computer on which theinstance of SQL Server runs. The returned value doesn't includethe timezone offset. -
sysdatetimeoffset
sysdatetimeoffset()
Returns a datetimeoffset(7) value containing the dateand time of the computer on which the instance of SQL Server runs. The returned value includes thetime zone offset. -
SYSUTCDATETIME
SYSUTCDATETIME()
Returns a datetime2(7) value containing the date and time of the computer on which the instance of SQL Server is running. Thefunction returns the dateand time values as UTC time (Coordinated UniversalTime). -
CURRENT_TIMESTAMP
CURRENT_TIMESTAMP
Returns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The returned value doesn't include the time zone offset. -
GETDATE
GETDATE()
Returns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The returned value doesn't include the time zone offset.
6.GETUTCDATE
GETUTCDATE()
Returns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The function returns the date and time values as UTC time (Coordinated UniversalTime).
datePart | 缩写形式 |
---|---|
day | dd, d |
week | wk, ww |
month | mm, m |
quarter | qq, q |
year | yy, yyyy |
hour | hh |
minute | mi, n |
second | ss, s |
millisecond | ms |
-
DATE_BUCKET 待理解
DATE_BUCKET(datepart, number, date, origin)
Returns a value corresponding to the start of each date-time bucket from the timestamp defined by the origin parameter, or the default origin value of 1900-01-01 00:00:00.000 if the origin parameter isn't specified. -
DATENAME
DATENAME ( datepart, date)
Returns a character string representing the specified datepart of the specified date.
获取时间的一部分。返回类型是字符串 -
DATEPART
DATEPART( datepart, date)
Returns an integer representing the specified datepart of the specified date.
同上,但是返回类型是数值 -
DATETRUNC
'DATETRUNC' 不是可以识别的 内置函数名称。
DATETRUNC ( datepart, date)
Returns an input date truncated to a specified datepart. -
DAY/MONTH/YEAR
fun(date)
Returns an integer representing the DAY/MONTH/YEAR part of the specified date. -
DATEFROMPARTS
DATEFROMPARTS( year, month, day )
Returns a date d value for the specified year, month, and day.
fractions:精度毫秒位的值
precision:精度
若精度为1,fraction单位为100ms,精度为2,单位为10ms,以此类推。
-
DATETIME2FROMPARTS
DATETIME2FROMPARTS( year, month, day, hour, minute, seconds, fractions, precision)
Returns a datetime2 value for the specified date and time, with the specified precision. -
DATETIMEFROMPARTS
DATETIMEFROMPARTS( year, month, day, hour, minute, seconds, milliseconds)
Returns a datetime value for the specified date and time. -
DATETIMEOFFSETFROMPARTS
DATETIMEOFFSETFROMPARTS( year, month, day, hour, minute, seconds, fractions, hour_offset, minute_offset, precision)
Returns a datetimeoffset value for the specified date and time, with the specified offsets and precision. -
SMALLDATETIMEFROMPARTS
SMALLDATETIMEFRO MPARTS( year, month, day, hour, minute)
Returns a smalldatetime value for the specified date and time. -
TIMEFROMPARTS
TIMEFROMPARTS( hour, minute, seconds, fractions, precision )
Returns a time t value for thespecified time, with thespecified precision. -
DATEDIFF
DATEDIFF ( datepart, startdate, enddate)
根据datepart的基准比较两个时间的差值
Returns the number of date or time datepart boundaries, crossed between two specified dates. -
DATEDIFF_BIG
DATEDIFF_BIG ( datepart, startdate, enddate)
同上,但返回值支持bigint
Returns the number of date or time datepart boundaries, crossed between two specified dates. -
DATEADD
DATEADD (datepart, number, date)
Returns a new datetime value by adding an interval to the specified datepart of the specified date. -
EOMONTH
EOMONTH ( start_date[, month_to_add ] )
Returns the last day of the month containing the specified date, with an optional offset. -
SWITCHOFFSET
SWITCHOFFSET (DATETIMEOFFSET, time_zone)
SWITCHOFFSET changes the time zone offset of a DATETIMEOFFSET value, and preserves the UTC value.
只改时区,不改时间 -
TODATETIMEOFFSET
TODATETIMEOFFSET (expression, time_zone)
TODATETIMEOFFSET transforms a datetime2 value into a datetimeoffset value. TODATETIMEOFFSET interprets the datetime2 value in local time, for the specified time_zone.
这篇关于截取微软文档 Datetime SqlServer的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-03-01沐雪多租宝商城源码从.NetCore3.1升级到.Net6的步骤
- 2024-12-06使用Microsoft.Extensions.AI在.NET中生成嵌入向量
- 2024-11-18微软研究:RAG系统的四个层次提升理解与回答能力
- 2024-11-15C#中怎么从PEM格式的证书中提取公钥?-icode9专业技术文章分享
- 2024-11-14云架构设计——如何用diagrams.net绘制专业的AWS架构图?
- 2024-05-08首个适配Visual Studio平台的国产智能编程助手CodeGeeX正式上线!C#程序员必备效率神器!
- 2024-03-30C#设计模式之十六迭代器模式(Iterator Pattern)【行为型】
- 2024-03-29c# datetime tryparse
- 2024-02-21list find index c#
- 2024-01-24convert toint32 c#