ale
ale

Reputation: 3431

Add numbers of day to Date SqLite

I need add +1 Day, to a selectec Date, in Slq the sintax is: SELECT DATEADD(day,+1, period.DateEnd) and it works, but in sqLite es different.

I try with this, but it doesn't work, for example, the DateEnd = '31/12/2012', I need add 1 day to that date, te resulset should be: DateEnd = '01/01/2013'

  SELECT date('period2.DateEnd', '+1 day') as date 
  FROM Period as period2 
  WHERE period2.c_Pk_CodPeriod = '1012'

Upvotes: 9

Views: 31443

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500785

Currently you've got period2.DateEnd as a string. I suspect you want:

SELECT date(period2.DateEnd, '+1 day') as date 
FROM Period as period2 
WHERE period2.c_Pk_CodPeriod = '1012'

Upvotes: 37

Related Questions