Page 1 of 1

Adding to a date

Posted: Tue Jun 11, 2019 4:31 pm
by ALW
Hi there,

I've just started using nuBuilder (which I'm loving so far!) and as a test case I'm building a simple database that keeps records of equipment and when it was last calibrated. Most fields are either typed by the user or lookups from other tables and that's all working a treat.

I want a column in the form that displays the calibration due date, which would be the calibration date field + 2 years. I initially set this up as a calc field in the initial form (so I have a database field allocated to it), but realised it isn't possible to do calculations on date fields, so I've hit a brick wall currently on how to achieve this.

Can anyone point me in the right direction please?

Thanks,

Andy.

Re: Adding to a date

Posted: Tue Jun 11, 2019 5:41 pm
by Alohajoe5
Andy,

Have you considered adding a field like Calculated_Date and using a DATE_ADD() function? The arguments DATE_ADD() accepts are listed here:

https://www.w3schools.com/sql/func_mysql_date_add.asp

Then, you could simply display that field.

Re: Adding to a date

Posted: Wed Jun 12, 2019 12:02 pm
by ALW
Have you considered adding a field like Calculated_Date and using a DATE_ADD() function?
Thank you!

I don't know why I didn't think of this, as I'd already used CONCAT in another field to combine multiple values, but my SQL is rusty and this was just the trigger I needed!

Re: Adding to a date

Posted: Sat Jun 15, 2019 11:56 pm
by admin
.