Sqlite参考手册
SQL Server DATEPART() 函数
SQL Server DATEPART() 函数
SQL Server DATEPART() 函数
SQL Server Date 函数
定义和用法
DATEPART() 函数用于返回日期/时间的单独部分,比如年、月、日、小时、分钟等等。
语法
DATEPART(datepart,date)
date 参数是合法的日期表达式。datepart 参数可以是下列的值:
datepart | 缩写 |
---|---|
年 | yy, yyyy |
季度 | qq, q |
月 | mm, m |
年中的日 | dy, y |
日 | dd, d |
周 | wk, ww |
星期 | dw, w |
小时 | hh |
分钟 | mi, n |
秒 | ss, s |
毫秒 | ms |
微妙 | mcs |
纳秒 | ns |
实例
假设我们有如下的 "Orders" 表:
OrderId | ProductName | OrderDate |
---|---|---|
1 | Jarlsberg Cheese | 2008-11-11 13:23:44.657 |
下面是 SELECT 语句:
SELECT DATEPART(yyyy,OrderDate) AS OrderYear,
DATEPART(mm,OrderDate) AS OrderMonth,
DATEPART(dd,OrderDate) AS OrderDay,
FROM Orders
WHERE OrderId=1
DATEPART(mm,OrderDate) AS OrderMonth,
DATEPART(dd,OrderDate) AS OrderDay,
FROM Orders
WHERE OrderId=1
结果如下所示:
OrderYear | OrderMonth | OrderDay |
---|---|---|
2008 | 11 | 11 |
SQL Server Date 函数
SQL Server DATEPART() 函数 |
---|
SQLite,是一款轻型的数据库,是遵守ACID的关系型数据库管理系统,它包含在一个相对小的C库中。它是D.RichardHipp建立的公有领域项目。它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了。它能够支持Windows/Linux/Unix等等主流的操作系统,同时能够跟很多程序语言相结合,比如 Tcl、C#、PHP、Java等,还有ODBC接口,同样比起Mysql、PostgreSQL这两款开源的世界著名数据库管理系统来
主页 | https://sqlite.org/ |
源码 | https://www.sqlite.org/src/ |
发布版本 | 3.21.0 |