DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL, SQLite and MS SQL Server; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

CALCULATED FIELDS WITH DATES

Posted by drashrafsabry 
CALCULATED FIELDS WITH DATES
September 16, 2018 03:07PM
If i have field 1 ( start Date ) and field 2 (end date), how can i make a calculated field formula to add 280 days to field 1 and the result in date format show in field 2?



Edited 1 time(s). Last edit at 09/17/2018 12:58AM by eugenio.
Re: CALCULATED FIELDS WITH DATES
September 17, 2018 01:02AM
Something like this in your custom function should work (I haven't checked it):

$date = $parameters_ar['start_date_field_name'];
return date('Y-m-d', strtotime($date. ' + 280 days'));

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Re: CALCULATED FIELDS WITH DATES
September 17, 2018 01:37AM
when i add a custom function n the date field , it says custom function does not support date fields in red alert
Re: CALCULATED FIELDS WITH DATES
September 17, 2018 02:44AM
i changed the target field type to text
it gives me empty space
no values just empty space
Re: CALCULATED FIELDS WITH DATES
September 17, 2018 03:02AM
Fixed thankyou
Re: CALCULATED FIELDS WITH DATES
September 17, 2018 06:39AM
Hello,
yes, I forgot to mention that calculated fields are only compatble with text, textarea and select_single field types. Yes you can switch the dadabik field type to text (and keep the db field type as date) but remember that you loose some features of the date field type e.g. you won't get any check on the date validity or date syntax if the user insert manually the date.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Sorry, only registered users may post in this forum.

Click here to login