SQLite 的默认时间 转自:http://www.cnblogs.com/pennant/archive/2011/08/11/2134897.html

select strftime('%Y-%m-%d %H:%M:%S','now')

这个查询的结果是 UTC时间,即 +8h 才和电脑时间相同。

select time('now')

这个查询的结果是 01:02:03 ,也要 +8h 才和电脑时间相同。

select date('now')

这个查询的结果是 2017-03-02

select datetime('now')

这个查询的结果是 2017-03-02 01:02:03

  %d 一月中的第几天01-31

  %f 小数形式的秒,SS.SSSS

  %H 小时00-24

  %j 一年中的第几天01-366

  %J Julian Day Numbers

  %m 月份01-12

  %M 分钟00-59

  %s 从1970-01-01日开始计算的秒数

  %S 秒00-59

  %w 星期,0-6,0是星期天

  %W 一年中的第几周00-53

  %Y 年份0000-9999

  %% %百分号

SQLite: Data Types - 数据类型

The following is a list of datatypes available in SQLite, which includes string, numeric, date/time, and large object datatypes.

For simplicity's sake, SQLite essentially uses these basic datatypes:

  • TEXT
  • INTEGER
  • NUMERIC
  • REAL
  • NONE

To be compatible with other SQL databases, SQLite allows you to use the common datatype names that you've seen in other databases and maps them to their basic SQLite datatypes (listed above).

Let's look at the common datatypes names that SQLite lets you define.

String Datatypes

All string datatypes in SQLite are converted to a TEXT datatype. If you try to specify a size for a string datatype, SQLite will ignore it, as it does not allow size restrictions on string datatypes.

The following are the String Datatypes in SQLite:

Data Type Syntax Explanation
CHAR(size) Equivalent to TEXT (size is ignored)
VARCHAR(size) Equivalent to TEXT (size is ignored)
TINYTEXT(size) Equivalent to TEXT (size is ignored)
TEXT(size) Equivalent to TEXT (size is ignored)
MEDIUMTEXT(size) Equivalent to TEXT (size is ignored)
LONGTEXT(size) Equivalent to TEXT (size is ignored)
NCHAR(size) Equivalent to TEXT (size is ignored)
NVARCHAR(size) Equivalent to TEXT (size is ignored)
CLOB(size) Equivalent to TEXT (size is ignored)

Numeric Datatypes

All numeric datatypes in SQLite are converted to INTEGER, NUMERIC, or REAL datatypes.

The following are the Numeric Datatypes in SQLite:

Data Type Syntax Explanation
TINYINT Equivalent to INTEGER
SMALLINT Equivalent to INTEGER
MEDIUMINT Equivalent to INTEGER
INT Equivalent to INTEGER
INTEGER Equivalent to INTEGER
BIGINT Equivalent to INTEGER
INT2 Equivalent to INTEGER
INT4 Equivalent to INTEGER
INT8 Equivalent to INTEGER
NUMERIC Equivalent to NUMERIC
DECIMAL Equivalent to NUMERIC
REAL Equivalent to REAL
DOUBLE Equivalent to REAL
DOUBLE PRECISION Equivalent to REAL
FLOAT Equivalent to REAL
BOOLEAN Equivalent to NUMERIC

Date/Time Datatypes

All date or time datatypes in SQLite are converted to NUMERIC datatypes.

The following are the Date/Time Datatypes in SQLite:

Data Type Syntax Explanation
DATE Equivalent to NUMERIC
DATETIME Equivalent to NUMERIC
TIMESTAMP Equivalent to NUMERIC
TIME Equivalent to NUMERIC

Large Object (LOB) Datatypes

The following are the LOB Datatypes in SQLite:

Data Type Syntax Explanation
BLOB Equivalent to NONE

[转]SQLite 经验集的更多相关文章

  1. [html]经验集

    禁止默认的右键菜单: window.document.oncontextmenu = function(){ return false;} WebBrowser 控件用法:(手动填充内容) // 首先 ...

  2. [转]Oracle 经验集

    -- 转换字符串为日期格式 to_date('2011-12-30 11:54:30','yyyy-MM-dd:hh24:mi:ss') Oracel 用 C# 连接,Microsoft 自带的 Sy ...

  3. [转]Windows 经验集

    Windows Server 2012 R2 显示 这台电脑 图标方法: 来自:https://jingyan.baidu.com/article/f25ef2544f6883482c1b82e5.h ...

  4. [转][Dapper]SQL 经验集

    condition.Append(" AND ChineseName like @name"); p.Add("@name", "%" + ...

  5. [java]经验集

    Calendar c = Calendar.getInstance(); c.set(1999,12,21); SimpleDateFormat sdf = new SimpleDateFormat( ...

  6. [Java.web][eclipse]经验集

    自动提示部分内容来自:http://www.cnblogs.com/mashuangying2016/p/6549991.html 使用 Eclipse 调试 Tomcat 的设置: Window - ...

  7. [转][c#]注册表经验集

    在 win7 64位的系统中,为了将程序做成绿化版(单EXE文件),一些设置准备放到 regedit(注册表)中. 测试时发现网上的 demo 可以读,但写的值调试不报错,相应位置却不存在,困扰了许久 ...

  8. [转]加密经验集 => C#

    下载地址 代码摘自 C#高级编程(第7版) 第579页 不对称加密

  9. [转]MySQL 经验集

    -- my.ini -> 在 [mysqld] 节点下加入一行 skip-grant-tables 然后重启服务 -- 接下来无密码登录到 mysql 执行以下命令 use mysql show ...

随机推荐

  1. PHP实现登录功能DEMO

    PHP实现登录的原理是什么呢?就是利用Session实现的,用户访问网站,系统会自动在服务器生成一个Session文件,这个Session可以用来存储用户的登录信息.好了,这是基本储备,我们下面来实现 ...

  2. PHP获取日期对应星期、一周日期、星期开始与结束日期的方法

    本文实例讲述了PHP获取日期对应星期.一周日期.星期开始与结束日期的方法.分享给大家供大家参考,具体如下: /* * 获取日期对应的星期 * 参数$date为输入的日期数据,格式如:2018-6-22 ...

  3. Flask_script扩展调用的方式

    Flask中flask-script扩展的使用 通过使用Flask-Script扩展,我们可以在Flask服务器启动的时候,通过命令行的方式传入参数.而不仅仅通过app.run()方法中传参 Flas ...

  4. kali linux下不能以root权限运行vlc的解决办法

    习惯了在Linux下面使用VLC播放视频和音乐, 但是 VLC 的 linux 版本并不支持在root下面运行. 终端运行vlc命令报错,错误信息如下 root@kbdancer:~# vlc VLC ...

  5. 解决错误:This bundle is invalid - The file extension must be .zip

    近期在 iOS 开发中遇到了一个很蛋疼的问题,Xcode 工程中接入了iMessage 壁纸的功能后,每次上传 ipa 包都会显示此包无效,并报上述的错误描述:This bundle is inval ...

  6. Faster R-CNN改进篇(二): RFCN ● RON

    @改进1:RFCN 论文:R-FCN: Object Detection via Region-based Fully Convolutional Networks    [点击下载] MXNet代码 ...

  7. Git钩子:自定义你的工作流

    Git钩子是在Git仓库中特定事件发生时自动运行的脚本.它可以让你自定义Git内部的行为,在开发周期中的关键点触发自定义的行为. Git钩子最常见的使用场景包括推行提交规范,根据仓库状态改变项目环境, ...

  8. [转]blocks编程

    原文地址:http://geeklu.com/2012/01/block/ 介绍 声明创建和调用 Block和变量 Block实际应用 1.介绍 Block是一个C Level的语法以及运行时的一个特 ...

  9. php simple_html_dom

    这个真的很好用,如果用正则,就太麻烦了. 首先,下载simple_html_dom,用include_once就可以使用了. 可以直接定位,可以像个对象一样操作,很方便. $ret=file_get_ ...

  10. sync-settings(vscode)

    vscode插件以及设置 sync-download e45c6db33cd91d661e0cc545efb6817c