sqlite3中时间函数
来源:互联网 发布:知乎删除回答重新回答 编辑:程序博客网 时间:2024/06/08 06:49
datetime()/datetime('now')显示的是零时区的时间,"YYYY-MM-DD HH:MM:SS"
如果要获得当前时区的可以 datetime('now','localtime')
如果知道是哪个时区的:datetime('now','-3 hours')
其它的时间函数:(摘自官网)
- date(timestring, modifier, modifier, ...)
- time(timestring, modifier, modifier, ...)
- julianday(timestring, modifier, modifier, ...)
- strftime(format, timestring, modifier, modifier, ...)
Examples
Compute the current date.
SELECT date('now');
Compute the last day of the current month.
SELECT date('now','start of month','+1 month','-1 day');
Compute the date and time given a unix timestamp 1092941466.
SELECT datetime(1092941466, 'unixepoch');
Compute the date and time given a unix timestamp 1092941466, and compensate for your local timezone.
SELECT datetime(1092941466, 'unixepoch', 'localtime');
Compute the current unix timestamp.
SELECT strftime('%s','now');
Compute the number of days since the signing of the US Declaration of Independence.
SELECT julianday('now') - julianday('1776-07-04');
Compute the number of seconds since a particular moment in 2004:
SELECT strftime('%s','now') - strftime('%s','2004-01-01 02:34:56');
Compute the date of the first Tuesday in October for the current year.
SELECT date('now','start of year','+9 months','weekday 2');
Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):
SELECT (julianday('now') - 2440587.5)*86400.0;
- sqlite3中时间函数
- Sqlite3时间&函数
- SQLite3中的日期时间函数使用小结
- SQLite3中的日期时间函数使用小结
- linux中对SQLite3函数的封装
- sqlite3函数
- sqlite3的时间类型
- sqlite3插入时间实例
- SQLite3获得本地时间
- sqlite3的时间查询
- SQL中时间函数
- php中时间函数
- Windows 中SQLite3 使用(2) -- 基本导出函数
- Windows 中SQLite3 使用(2) -- 基本导出函数
- Sqlite3中对于毫秒数和本地时间之间的转换以及时间相关操作
- sqlite3-------函数使用方法
- sqlite3 函数执行吗
- sqlite3内置函数
- Windows下socket通信步骤
- 不用sizeof来求出int的大小(程序)
- 用Darwin实现流媒体转发程序(附源码)
- 求32位机器上unsigned int的最大值及int的最大值
- Linux内核学习之四库全书 .
- sqlite3中时间函数
- 关于TI Ducati 的部分详解
- adb shell 提示符: $改为#
- 浅谈VB.NET中的接口
- android dependencies介绍
- 【报表开发】iReport使用心得
- 电驴提示“该内容尚未提供权利证明,无法提供下载”之解决办法
- 学点读心术 教你看透人心
- Linux下修改swap的大小