Busy recentlyWeibo fan genieI am very busy. I have no time to write a blog post. I want to secretly write a few lines today.
The commonly used datediff function in MSSQL returns the number of days difference between two days. In SQLite, there is a function julianday, which can be replaced.
The usage is: julianday (datetime ()-julianday (createtime) -- createtime is the column name.
It has always been used in this way. It is a bit necessary today. The same click is valid for one day. It is written as: Where julianday (datetime ()-julianday (createtime) = 0.
After debugging, I found several errors.
1: The difference between julianday (datetime ()-julianday (createtime) is not an integer, It is a floating point, so it is not equal to 0.
Datediff (D, getdate (), '2017-10-13 11:11:11 ') is an integer, which is a difference.
2: datetime (). The default value is UTC time, which is the time difference between it and our default time. Just change it to datetime ('now ', 'localtime.
Therefore, the correct syntax is: where julianday (datetime ('now ', 'localtime')-julianday (createtime) <1
OK. This is a small record here.