For a procedure anyway, something like... with recursive iterations (iteration, dateGuess) as ( values (1, '2016-08-01') union all select iteration + 1, date(dateGuess, '1 years') from iterations where dateGuess < date('now')) select dateGuess from iterations order by iteration desc limit 1;
dateGuess 2018-08-01 with recursive iterations (iteration, dateGuess) as ( values (1, '2016-08-01') union all select iteration + 1, date(dateGuess, '7 days') from iterations where dateGuess < date('now')) select dateGuess from iterations order by iteration desc limit 1; dateGuess 2017-10-02 -----Original Message----- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Stephen Chrzanowski Sent: Wednesday, September 27, 2017 10:15 AM To: General Discussion of SQLite Database Subject: [sqlite] Recurring Dates Does anyone have any decent functions or procedures that when given a date and a recurring type that SQLite gives the current or next date? Take for instance - using today as the base date, a date of Aug 1, 2016 with a yearly recurring date, I'd like to get Aug 1, 2018. - using today as the base date, a date of Aug 1, 2016 with a weekly recurring date, I'd like to get Sept 2, 2017. I plan on feeding this function todays date, the target date (Theoretically a constant), and the recursive type being daily, weekly, monthly and yearly. (Not interested in the weekend before the 15th of any month, kinda deal). _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users