Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add numbers of day to Date SqLite

Tags:

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'
like image 304
ale Avatar asked Nov 22 '12 19:11

ale


1 Answers

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'
like image 102
Jon Skeet Avatar answered Oct 19 '22 04:10

Jon Skeet