--返回UTC时间
select CURRENT_TIMESTAMP;
--返回本地时间
select datetime(CURRENT_TIMESTAMP,'localtime');
--时间转换,时间转换时要求: yyyy-MM-dd,例如: 2008-08-09
SELECT datetime('2008-12-22') AS [My Time];
SELECT datetime('2008-12-22') AS "My Time";--必须为双引号
SELECT
SELECT
select CURRENT_TIME;--返回当前UTC时间
select CURRENT_DATE;--返回当前UTC日期
select julianday('2008-12-22') - julianday('2008-12-21');--日期比较
--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 Independent.
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;
Select rowID,* From keys order by rowID asc limit 5 Offset 5 ;--sqlite分页显示,表示跳过5行,再取5行,即第二页
总结以上是内存溢出为你收集整理的sqlite常用sql语句全部内容,希望文章能够帮你解决sqlite常用sql语句所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)