Some function usages of sqlite

Source: Internet
Author: User
Tags local time sqlite

--Greenwich Date TIME, 8 hours later than Beijing time select datetime (' Now ');--Greenwich DATE Select date (' Now ');--local time (' Now ', ' localtime ');-- Date Time Format Select Strftime ('%y-%m-%d%h:%m:%s ', ' Now ', ' localtime ');--Add 1 hours Select datetime (Date (' Now '), ' +1 Hour ');-- Plus 1 hours and 30 minutes Select datetime (Date (' Now '), ' +1 hour ', ' +30 minute ');--Last day of the month Select date (' Now ', ' localtime ', ' start of month ', ' +1 month ', '-1 day ');--1th Select date of the month (' Now ', ' localtime ', ' start of Month ');--Next month, number 1th, select Date (' Now ', ' localtime ', ' Start Of month ', ' +1 month ');--intercept the string (the 2nd parameter is the starting position from 1, and the 3rd position is the Intercept length): The result is 123select substr (' abc123 ', 4, 3);--Calculate length, result is 6select Length (' abc123 ');--Returns lowercase, uppercase, result abc,abcselect lower (' abc '), Upper (' abc ');--Rounding retains 2 decimal places select round (CAST (1 as Double)/ Cast (3 as Double), 2),--case when usage selectcase when cast (strftime ('%H ', ' Now ', ' localtime ') as int) >= 6 and cast (strftime ('%H ', ' Now ', ' localtime ') as Int. <=12 then ' AM ' when cast (strftime ('%H ', ' Now ', ' localtime ') as int) >12 and cast (St Rftime ('%H ', ' Now ', ' localtime ') as int) <=18 then ' the afternoon ' when cast (strftime ('%H ', 'Now ', ' localtime ') as int) >18 and cast (strftime ('%H ', ' Now ', ' localtime ') as int) <=23 and ' Night ' else ' early ' end;  

Some function usages of sqlite

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.