Good afternoon, how can I create a function that calculates an expiration date according to the date it was entered in the database (created).
Forums
Calculate expiration date
{date:d-m-Y$(data:field_name_with_date)+100days}The above code will take a date value coming from a field named "field_name_with_date" and add 100 days and return the date!
How can I display this to the user?
if you have it in a "Custom code" or html then it will be displayed!
I would like to create an expiration date.
A deadline of 10 days.
Where every day was reduced one day.
And after the deadline displays a message (Delayed Content).
I do not know how to do this.
A deadline of 10 days.
Where every day was reduced one day.
And after the deadline displays a message (Delayed Content).
I do not know how to do this.
What are you displaying it to the user in?
You can use PHP to calculate how many days it has been since a certain date, or if the current date is more than 10 days past the given date.
Then use a Switch Event on {var:php_block_name} to display the message if necessary.
You can use PHP to calculate how many days it has been since a certain date, or if the current date is more than 10 days past the given date.
Then use a Switch Event on {var:php_block_name} to display the message if necessary.
I want to show the way it is in the image for the user.

So, in Chronoconnectivity? Use a PHP block in your column view, like
columnname:{fn:expiry_check$entry_date=(var:tableviewname.row.model.date)}Then in the php block you've called expiry_check you can use $this->get("entry_date") to get the date and perform the calculation. Just echo out the text you want.
I did not understand with resolve this
what do I want to do? Get the value of the "created" field, format for dd/mm/YYYY and add 10 days and display this in a table.
what do I want to do? Get the value of the "created" field, format for dd/mm/YYYY and add 10 days and display this in a table.
You just want to display? Then
columnname:{date:d/m/Y$(var:tableviewname.row.model.created) +10 days}
It worked.
How can I get his value and make a calculation?
For example:
Get the value from when it was created and calculate with the value of the current day ...
How can I get his value and make a calculation?
For example:
Get the value from when it was created and calculate with the value of the current day ...
https://www.php.net/manual/en/datetime.diff.php
You'll have to do it using PHP. Remember you can't use shortcodes in PHP, so for a {var:} call you would use $this->get("var_name") and for {data: you use $this->data("data_name")
You'll have to do it using PHP. Remember you can't use shortcodes in PHP, so for a {var:} call you would use $this->get("var_name") and for {data: you use $this->data("data_name")
This is very difficult for me.
Or in your Fields to Retrieve for your read data action, you can try
DATEDIFF(model.created , CURDATE()):model.calculated_dateTake note of the spaces around the comma
This topic is locked and no more replies can be posted.