Add DueDays to InvoiceDate in SQLite

I have two fields in my Invoice table that I want to add to get the date the invoice is actually due.
InvoiceDate is of type TIMESTAMP and DueDays is INTEGER.
I would like to add DueDays days to the InvoiceDate date and return as DueDate ie

(DATE(InvoiceDate, '+DueDays days')) AS DueDate

But DueDate returns as blank (InvoiceDate is 2022-01-01 00:00:00 and DueDays is 30 and appear in the report). I can add an absolute number of days eg DueDate appears as ‘2022-01-31’:
(DATE(InvoiceDate, '+30 days')) AS DueDate

but can you add an integer field number of days?

I know this is not Xojo per se, but I have searched online and found no workaround.

As time stamps are usually stored as seconds, could you multiply your days by 86400, add them to the time stamp and pull that value to stick into a DateTime?

select *, DATE(mydate, '+' || mydays || ' days') AS newdate from MyNewTable

2 Likes

Genius!

1 Like