zoukankan      html  css  js  c++  java
  • SQLite一些函数用法

    --格林威治日期时间,比北京时间晚8小时
    select datetime('now');
    
    --格林威治日期
    select date('now');
    
    --本地时间
    select time('now','localtime');
    
    --日期时间格式化
    select strftime('%Y-%m-%d %H:%M:%S','now','localtime');
    
    --加1小时
    select datetime(date('now'),'+1 hour');
    
    --加1小时30分钟
    select datetime(date('now'),'+1 hour','+30 minute');
    
    --当月最后一天
    select date('now','localtime','start of month','+1 month','-1 day');
    
    --当月1号
    select date('now','localtime','start of month');
    
    --下月1号
    select date('now','localtime','start of month','+1 month');
    
    --截取字符串(第2个参数为从1算起的开始位置,第3个位置为截取长度):结果为123
    select substr('abc123',4,3);
    
    --计算长度,结果为6
    select length('abc123');
    
    --返回小写、大写,结果为abc,ABC
    select lower('abC'),upper('abC');
    
    --四舍五入保留2位小数
    select round(cast(1 as double)/cast(3 as double),2);
    
    --case when用法
    select
    case 
    when cast(strftime('%H','now','localtime') as int) >= 6 and cast(strftime('%H','now','localtime') as int) <=12  then '上午'  
    when cast(strftime('%H','now','localtime') as int) >12 and cast(strftime('%H','now','localtime') as int) <=18  then '下午' 
    when cast(strftime('%H','now','localtime') as int) >18 and cast(strftime('%H','now','localtime') as int) <=23  then '晚上'   
    else '凌晨' end; 
    
  • 相关阅读:
    深度学习100问
    BAT机器学习面试1000题系列
    深度学习项目——基于卷积神经网络(CNN)的人脸在线识别系统
    深入理解卷积层
    AI大道理头尾标识
    git-svn Manual Page
    收藏夹
    C语言 #、##、#@在#define中的用法
    ubuntu 编译安装自己的git-svn
    ALSA参考文档
  • 原文地址:https://www.cnblogs.com/gdjlc/p/5438983.html
Copyright © 2011-2022 走看看