SQLite相当于SQL Server DateAdd函数

时间:2021-03-10 15:43:45

I need help reproducing the following SQL statement to a statement that SQLite understands.

我需要帮助将以下SQL语句复制到SQLite理解的语句中。

SELECT * FROM SomeTable WHERE [Date] >= DATEADD(day, -14, GETDATE())

Any help is much appreciated!

任何帮助深表感谢!

2 个解决方案

#1


22  

From this link

从这个链接

Date And Time Functions

日期和时间函数

it would seem that you can use something like

你似乎可以使用类似的东西

date(timestring, modifier, modifier, ...) 

SELECT date('now','+14 day'); 

Does this seem correct to you?

这对你来说是否正确?

#2


1  

The method Adriaan Stander gives result in GMT

Adriaan Stander的方法给出了GMT的结果

You can do it in LocalTime like this

你可以在LocalTime中这样做

select DateTime('Now', 'LocalTime', '+1 Day');

#1


22  

From this link

从这个链接

Date And Time Functions

日期和时间函数

it would seem that you can use something like

你似乎可以使用类似的东西

date(timestring, modifier, modifier, ...) 

SELECT date('now','+14 day'); 

Does this seem correct to you?

这对你来说是否正确?

#2


1  

The method Adriaan Stander gives result in GMT

Adriaan Stander的方法给出了GMT的结果

You can do it in LocalTime like this

你可以在LocalTime中这样做

select DateTime('Now', 'LocalTime', '+1 Day');